Read more

Git: Diff staged changes

Arne Hartherz
January 26, 2012Software engineer at makandra GmbH

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.

Illustration online protection

Rails Long Term Support

Rails LTS provides security patches for old versions of Ruby on Rails (2.3, 3.2, 4.2 and 5.2)

  • Prevents you from data breaches and liability risks
  • Upgrade at your own pace
  • Works with modern Rubies
Read more Show archive.org snapshot

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.

Posted by Arne Hartherz to makandra dev (2012-01-26 15:54)