Skip to content

Instantly share code, notes, and snippets.

@afgomez
Last active April 9, 2023 18:04
Show Gist options
  • Star 4 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save afgomez/13c519b191126974cd35844d957cdd8b to your computer and use it in GitHub Desktop.
Save afgomez/13c519b191126974cd35844d957cdd8b to your computer and use it in GitHub Desktop.
FZF git-checkout
#!/bin/bash
branch=`git branch -a | sed 's/^\*//; s/^[ \t]*//; /HEAD.*/d; /^remotes\/origin\/$/d' | fzf --height 40% --border --reverse --preview 'git log --color=always {} -10' | sed 's/remotes\/origin\///'`
if [[ $branch ]]; then
git checkout $branch
fi
@johnsyweb
Copy link

Great preview idea, I "borrowed" it here: https://github.com/johnsyweb/bin/blob/master/git-cof . Thanks.

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