Abbreviation for getting diff from last N commit?

I know that I can:

git diff HEAD^..HEAD

But are there some abbreviations that are easier to remember, for example:

git diff foo N

where Ncan there be any number of commits from now on to get cumulative diff?

+5
source share
2 answers

From NOTE revision of the manual pagesgit rev-parse :

The suffix ~<n>to the revision parameter means the commit object, which is the ancestor of the <n>th generation of the named commit object, after only the first parent.
That is rev~3equivalent rev^^^, which is equivalent rev^1^1^1.

Consider the examples in the git diffman page :

git diff HEAD^..HEAD
git diff HEAD^..
git diff HEAD^ HEAD

( chrisk HEAD^.., ).
( git diff HEAD^, Mark Longair, diff , )

:

git diff HEAD~15       # diff the working tree with the 15th previous commit
git diff HEAD~15 HEAD  # diff the last commit  with the 15th previous commit

, ( khmarbaise ).

+16

git diff HEAD~N. git diff HEAD~N.., .

+4

All Articles