Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
in DevOps and Agile by (29.3k points)

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

git diff last version:HEAD

1 Answer

0 votes
by (50.2k points)

As the previous commit can be accessed with HEAD^:

git diff HEAD^ HEAD

In git version 1.8.5, @ is an alias for HEAD

git diff @~..@

One more way that you can use:

git show

To see the difference between head and commit using:

git diff commit_id HEAD

Since comparison to HEAD is default you can omit it for comparing with HEAD use:

git diff @^

git diff HEAD^

git diff commit_id


Related questions

0 votes
1 answer
0 votes
1 answer
asked Jul 25, 2019 in DevOps and Agile by chandra (29.3k points)

Browse Categories