-
-
Save AnoRebel/7abc2522cd713976abdc3774b5c45c20 to your computer and use it in GitHub Desktop.
Browsing git commit history with fzf
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
#!/bin/zsh | |
# git-fshow - git commit browser | |
# | |
# https://gist.github.com/akatrevorjay/9fc061e8371529c4007689a696d33c62 | |
# https://asciinema.org/a/101366 | |
# | |
git-fshow() { | |
local g=( | |
git log | |
--graph | |
--format='%C(auto)%h%d %s %C(white)%C(bold)%cr' | |
--color=always | |
"$@" | |
) | |
local fzf=( | |
fzf | |
--ansi | |
--reverse | |
--tiebreak=index | |
--no-sort | |
--bind=ctrl-s:toggle-sort | |
--preview 'f() { set -- $(echo -- "$@" | grep -o "[a-f0-9]\{7\}"); [ $# -eq 0 ] || git show --color=always $1; }; f {}' | |
) | |
$g | $fzf | |
} | |
git-fshow "$@" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment