How can i view git diff for any commit using vim-fugitive?

Sathish picture Sathish · Mar 12, 2013 · Viewed 25.6k times · Source

vim-fugitive side-by-side git diff is great for viewing diff of unstaged files.

How can i use vim-fugitive to git diff

  • staged files?
  • any git revision?

Answer

Peter Rincker picture Peter Rincker · Mar 12, 2013

Diff between current file and the index

:Gdiff :0

Diff between current file and some other [revision]

:Gdiff [revision]

Diff between current file and current file 3 commits ago:

:Gdiff ~3