I am happy working with git difftool --dir-diff
with beyond compare to show overall diff across directories and files and navigate through them.
However when it comes to vimdiff, seems it do not support dir diff from git. A git alias I created is as the following
dirdiff = difftool --ignore-submodules --tool=vimdiff --dir-diff --no-symlinks
After I do things like git dirdiff HEAD~1 HEAD
, it list my 2 directories on left and right with vim built in netrw
file browser. However, press enter on any of them don't make folder expanded on both sides, not to mention open a file with side by side diff.
vimdiff works fine for showing single file diff in visual mode, is there a way to make it also works for --dir-diff
?
I find a solution from another stackoverflow thread. The answer is provided by @user744629. Following his suggestion
.gitconfig
[alias]
dirdiff = difftool --ignore-submodules --dir-diff --no-symlinks --tool=vimdirdiff
[difftool "vimdirdiff"]
cmd = vim -f '+next' '+execute \"DirDiff\" argv(0) argv(1)' $LOCAL $REMOTE
After that you can use git dirdiff HEAD HEAD~1
to view side by side diff.