Skip to content

Instantly share code, notes, and snippets.

@thomasaarholt
Created March 21, 2023 20:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thomasaarholt/08b816d901ece2136c09d0e39b98ed0f to your computer and use it in GitHub Desktop.
Save thomasaarholt/08b816d901ece2136c09d0e39b98ed0f to your computer and use it in GitHub Desktop.
git branch change using fzf in lovely color
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
}
@thomasaarholt
Copy link
Author

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment