From the SPECIFYING REVISIONS of the git rev-parse
man page:
A suffix
~<n>
to a revision parameter means the commit object that is the<n>
th generation grand-parent of the named commit object, following only the first parent.
I.e.rev~3
is equivalent torev^^^
which is equivalent torev^1^1^1
.
Consider the examples in the git diff
man page:
git diff HEAD^..HEAD
git diff HEAD^..
git diff HEAD^ HEAD
are equivalent forms (thanks chrisk for the HEAD^..
form, as mentioned in the comments).
(they are not equivalent to git diff HEAD^
, as Mark Longair comments, since it diff
with the working directory, not the last commit)
So:
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
should do what you need (as khmarbaise mentions in the comment).