Last active
April 9, 2023 18:04
-
-
Save afgomez/13c519b191126974cd35844d957cdd8b to your computer and use it in GitHub Desktop.
FZF git-checkout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Great preview idea, I "borrowed" it here: https://github.com/johnsyweb/bin/blob/master/git-cof . Thanks.