Created
November 23, 2023 15:58
-
-
Save srsholmes/5607e26c187922878943c50edfb245ef to your computer and use it in GitHub Desktop.
Recent git branches
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function grecent() { | |
local branches branch | |
branches=$(git branch --sort=-committerdate --format='%(HEAD) %(color:yellow)%(refname:short)%(color:reset) - %(contents:subject) %(color:green)(%(committerdate:relative)) [%(authorname)]') \ | |
&& branch=$(echo "$branches" | fzf --ansi) \ | |
&& branch=$(echo "$branch" | awk '{print $1}' | tr -d '*') \ | |
&& git checkout "$branch" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment