Created
November 13, 2017 01:09
-
-
Save mikiyaf/d2aa9910fd5049915cdd899038bcd14e to your computer and use it in GitHub Desktop.
fshow - git commit browser (enter for show, ctrl-d for diff)
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
| fshow() { | |
| local out shas sha q k | |
| while out=$( | |
| git log --graph --color=always \ | |
| --format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" | | |
| fzf --ansi --multi --no-sort --reverse --query="$q" \ | |
| --print-query --expect=ctrl-d); do | |
| q=$(head -1 <<< "$out") | |
| k=$(head -2 <<< "$out" | tail -1) | |
| shas=$(sed '1,2d;s/^[^a-z0-9]*//;/^$/d' <<< "$out" | awk '{print $1}') | |
| [ -z "$shas" ] && continue | |
| if [ "$k" = ctrl-d ]; then | |
| git diff --color=always $shas | less -R | |
| else | |
| for sha in $shas; do | |
| git show --color=always $sha | less -R | |
| done | |
| fi | |
| done | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment