Diff of current and previous version using vim-fugitive

zoran119 picture zoran119 · May 29, 2013 · Viewed 9.4k times · Source

I know that :Glog will populate the quickfix list with all the versions of the file in the current buffer and that I can hit <enter> on these to see the file at that particular version, but is there an easy way to see the diff of a particular version with the previous version (to easily see what has changed)?

EDIT: What I'm after is seeing each of these changes in a vertical diff in vim: git log -p -- path/to/file.txt.

Answer

David picture David · May 29, 2013

This is what I use:

:Gdiff [revision]

See :help Gdiff for other options as well (vertical vs horizontal splits, etc).

For example:

:Gdiff HEAD

or if you have a revision number (ie: aaffdfdstsdgssetds):

:Gdiff aaffdfds