This is part of the Semicolon&Sons Code Diary - consisting of lessons learned on the job. You're in the vim category.
Last Updated: 2024-12-03
Running git diff
was becoming annoying, especially where there were many
files. Its linear way of showing things one after the other (instead of side by
side) is ill-suited to the job of diffing.
Enter neovim as a difftool
In my .gitconfig
file:
[diff]
tool = nvimdiff
[difftool "nvimdiff"]
cmd = "nvim -d -u ~/.vimrc \"$LOCAL\" \"$REMOTE\""
Now I can run the following to get a side by side diff in a familiar editor:
$ git difftool featurebranch
If I was on a random Linux box without neovim
I could do the following
(assuming vim was on the machine, which it probably is)
$ git difftool featurebranch --difftool=vimdiff