Created
March 21, 2023 20:41
-
-
Save thomasaarholt/08b816d901ece2136c09d0e39b98ed0f to your computer and use it in GitHub Desktop.
git branch change using fzf in lovely color
This file contains hidden or 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
branch () { | |
branches=$(git for-each-ref --sort=-committerdate refs/heads/ --format='%(color:cyan)%(refname:short)|%(color:bold green)%(committerdate:relative)|%(color:magenta)%(authorname)%(color:reset)' --color=always|column -ts'|') && | |
branch=$(echo "$branches" | fzf --multi --ansi --height=20%) | |
if [ -z "${branch}" ]; | |
then return 0 | |
else git switch $(echo "$branch" | sed "s/ .*//") | |
fi | |
} |
Author
thomasaarholt
commented
Mar 21, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment