Rajeev Rajeev - 8 months ago 24
Git Question

Finding diff between current and last versions?

Using git, how can you find the difference between the current and the last versions?

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

If you want to know the diff between head and any commit you can use:

git diff commit_id HEAD

The following will also work:

git show

And this will launch your visual diff tool (if configured):

git difftool HEAD^ HEAD


As of Git 1.8.5, @ is an alias for HEAD, so you can use:

git diff @~..@