Last active
June 5, 2019 10:39
-
-
Save chmouel/ecb59b7d265a7f14997b9ad74515edcb to your computer and use it in GitHub Desktop.
Choose branch with FZF including preview diff with bat
This file contains 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
chosen=$(git branch --sort=-committerdate --format '%(refname:short)' -l|grep -v heads/|fzf --border --preview "git log --no-merges --patch-with-stat {}|bat --language=diff --color=always" --bind CTRL-P:preview-up,CTRL-N:preview-down,CTRL-SPACE:preview-page-down --preview-window=up:80%) | |
[[ $1 == -n ]] && { echo $chosen ; return ;} | |
git checkout ${chosen} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment