Last active
May 24, 2023 23:29
-
-
Save AksAman/a8b48c77bf8b24e983211a5bef49ce28 to your computer and use it in GitHub Desktop.
Alias to view git log in a pretty way with fuzzy search and files preview using fzf
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
| # fzf from https://github.com/junegunn/fzf | |
| # diff-so-fancy from https://github.com/so-fancy/diff-so-fancy | |
| gcop() { | |
| git log \ | |
| --reverse \ | |
| --color=always \ | |
| --format="%C(cyan)%h %C(blue)%ar%C(auto)%d% C(yellow)%s%+b %C(magenta)%ae" "$@" | | |
| fzf -i -e +s \ | |
| --reverse \ | |
| --tiebreak=index \ | |
| --no-multi \ | |
| --ansi \ | |
| --preview="echo {} | | |
| grep -o '[a-f0-9]\{7\}' | | |
| head -1 | | |
| xargs -I % sh -c 'git show --color=always % | | |
| diff-so-fancy'" \ | |
| --header "enter view, C-c: copy hash" \ | |
| --bind "enter:execute:$_viewGitLogLine | less -R" | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment