The command :Gdiff
is equivalent to running git diff
on that file.
What's the equivalent for git diff --staged
or git diff --cached
?
I've found a way to do this. Run :Git
, you should get a window with contents like the following:
# Head: master
# Merge: origin/master
# Help: g?
#
# Staged (1)
# M example.txt
#
Scroll down to the staged file, example.txt
, and press dd. This will open a diff view, comparing what's in HEAD and what's in the index. You'll notice on the bar on the bottom that both the filenames are special Fugitive filenames.
Also while in :Git
preview window, you can press g?, which will list all the mappings valid in the current context.