Is it possible to use
vim diff to open and compare all the differences between
HEAD and the files in the working directory?
To view unstaged modifications to your git working tree in vimdiff, try:
git difftool --tool=vimdiff
or for staged changes
git difftool --tool=vimdiff [ --staged | --cached ]
These commands are invoking
git difftool and specifying
vimdiff at invocation, so should work without any prior configuration.
However, until you configure
vimdiff as the default difftool, you will have to continue passing the
--tool=vimdiff option to
Also, I suggest incrementally increasing your usage of vim as a git diffing tool, some people suggest jumping right in re-mapping the
git diff command to use vimdiff, but retaining the ability to use
git diff can still be useful.
Also some people suggest turning off prompting, i.e. running
git config --global difftool.prompt false
I don't use this because I want to go back to a shell between viewing files, so I can cancel out of the diff'ing if necessary.
making edits right there in vimdiff
An advantage of using vim over
git diff is that when you are viewing unstaged or staged files in
vimdiff you can go ahead and change the file right there in vim, which is really handy.
You need to use
:w! to force past vims warning of modifying a read only file though. Also, if you change a file that was staged, you will need to re-stage to include the edit into the next commit.
Setting vimdiff as your git difftool
You can use
git config --global diff.tool vimdiff
[diff] tool = vimdiff
~/.gitconfig or to be repo specific: