Skip to content

Instantly share code, notes, and snippets.

@sreetamdas
Created September 25, 2024 07:39
Show Gist options
  • Save sreetamdas/caf14a857013c715638c5f544c167978 to your computer and use it in GitHub Desktop.
Save sreetamdas/caf14a857013c715638c5f544c167978 to your computer and use it in GitHub Desktop.
Switch to git branch, listed in chronological order
# add to .gitconfig
[alias]
ch = !git checkout $(git reflog show --pretty=format:'%gs ~ %gd' --date=relative | grep 'checkout:' | grep -oE '[^ ]+ ~ .*' | awk -F~ '!seen[$ 1]++' | head -n 20 | cut -d '~' -f 1 | fzf)
# add to .zshrc
alias gcoo="git ch"
# use as:
gcoo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment