Place this code in a file somewhere in $PATH
. I place it in a script called git-fbr-files
.
The script takes an old revision and a new revision and will show individual files changed. Select the file with FZF and hit enter to view a diff.
#!/usr/bin/env zsh
old="$1"
new="$2"
git diff --name-status --relative $old $new |
fzf --reverse --bind="ctrl-m:execute:(echo {} | cut -f 2 |
xargs -I % git diff --patience --color=always $old $new -- % | less -R)"
This script depends on the script above. If you put it in a file called something other than git-fbr-files
make sure to update. Run in a git repository to see a graph of the commits. Select a commit and hit enter to see the commit diff, hit ctrl-b to break it down by file.
#!/usr/bin/env zsh
git log --graph --color=always \
--format="%C(auto)%h%d %s %C(black)%C(bold)%cr" "$@" |
fzf --ansi --no-sort --reverse --tiebreak=index \
--bind="ctrl-s:toggle-sort" \
--bind="ctrl-m:execute:(echo {} | grep -o '[a-f0-9]\{7\}' | head -1 |
xargs -I % git show --patience --color=always % | less -R)" \
--bind="ctrl-b:execute:(echo {} | grep -o '[a-f0-9]\{7\}' |
xargs -I % git fbr-files %^ %)"