Git: Diff staged changes

Updated . Posted . Visible to the public.

Saying git diff only shows unstaged changes relative to the index (or HEAD if the index is empty, alternatively any hash or branch you supplied) but leaves out files you already staged for the next commit.

To diff your added changes with HEAD, say:

git diff --cached

Effectively, this gives you the changes you will commit when you run git commit without the -a switch.

Arne Hartherz
Last edit
Ruben Aleman
License
Source code in this card is licensed under the MIT License.
Posted by Arne Hartherz to makandra dev (2012-01-26 14:54)