Skip to content

Instantly share code, notes, and snippets.

@MarcusResell
Last active November 29, 2021 09:19
Show Gist options
  • Save MarcusResell/630c77f2bc549f4680fed4b5da43d743 to your computer and use it in GitHub Desktop.
Save MarcusResell/630c77f2bc549f4680fed4b5da43d743 to your computer and use it in GitHub Desktop.
List all local branches according to time and pick which one you want to checkout
# List all local branches according to time and pick which one you want to checkout
# requires xargs, awk, fzf, sed to be installed
lb = !git branch --sort='-committerdate' --format='%(color:green)%(committerdate:relative)%(color:reset) %(refname:short)' | fzf --ansi --layout=reverse --border=rounded --info=hidden --height=10 | sed 's/.*ago[ ]*//g' | xargs git checkout
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment