Skip to content

Instantly share code, notes, and snippets.

@MarcusResell
Created November 29, 2021 09:19
Show Gist options
  • Save MarcusResell/b08a0ba01f1e7c6b581dfe94adc6c017 to your computer and use it in GitHub Desktop.
Save MarcusResell/b08a0ba01f1e7c6b581dfe94adc6c017 to your computer and use it in GitHub Desktop.
List all local and up-to-date remote branches according to time and pick which one you want to checkout
# requires xargs, awk, fzf, sed to be installed
lb-remote = !git fetch --all --prune && git branch -a --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