Useful workflows that rely on a combination of tools.
vim -c 'tabdo Gdiff origin/master' -p $(git diff --name-only origin/master | fzf)
I've found this useful enough to add as a git alias. The above implementation diffs against the branch point instead of
origin/masterwhich results in a cleaner diff.
When reviewing a feature branch, sometimes you want to know how one specific feature was impacted by the branch. For example, you want to see how every file in a certain directory or with a certain name was changed.
We open Vim with the command "for each tab (
tabdo), diff the file against its version on master (
Gdiff origin/master), and then we pass it the list of all files changed in the current branch (
git diff --name-only origin/master), filtered using
What happens is that
fzf's prompt opens up, letting you select a list of files using
Tab. Upon completing your selection, all files will be diffed in splits in separate tabs, which you can navigate between using
fd PATTERN | fzfis a good building block for building filterable commands.
vim `fd PATTERN | fzf`
cat `fd PATTERN | fzf`
# open parent folder of found file
open "`fd PATTERN | fzf`/.."