How can I "diff -c" with git?

In $ VCS, I heavily use $VCS diff -c $N to see only the changes made to the revision of $N (i.e. diff -r $N..$N+1 ).

How can i do the same with git?

+4
source share
2 answers
 # git show -p SHA1_COMMIT 
+8
source
 git diff SHA1_COMMIT^ SHA1_COMMIT 

With SHA1_COMMIT is the SHA1 commit you want to check.
What " git diff " will compare:

  • pre-commit version referenced by these SHA1 and
  • the commit referred to by SHA1.

As mentioned in the source code of the built-in diff.c , parsing:

 static const char builtin_diff_usage[] = "git diff <options> <rev>{0,2} -- <path>*" 
+6
source

All Articles