Finding diff between current and last version


Using Git, how can you find the difference between the current and the last version?

git diff last version:HEAD


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

That also can be applied for a :commithash

git diff $commithash^ $commithash

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


  • @ScottF and @Panzercrisis explain in the comments that on Windows the ~ character must be used instead of ^.

View a file in a different Git branch without changing branches

Git add and commit in one command