I don't really understand the meaning of "last version".
As the previous commit can be accessed with HEAD^, I think that you are looking for something like:
git diff HEAD^ HEAD
As of Git 1.8.5, @
is an alias for HEAD
, so you can use:
git diff @~..@
The following will also work:
git show
If you want to know the diff between head and any commit you can use:
git diff commit_id HEAD
And this will launch your visual diff tool (if configured):
git difftool HEAD^ HEAD
Since comparison to HEAD is default you can omit it (as pointed out by Orient):
git diff @^
git diff HEAD^
git diff commit_id
Warnings
- @ScottF and @Panzercrisis explain in the comments that on Windows the
~
character must be used instead of ^
.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…