Back

Explore Courses Blog Tutorials Interview Questions
0 votes
1 view
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 @[email protected]

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

Reference: https://git-scm.com/docs/git-diff#Documentation/git-diff.txt-Comparingwitharbitrarycommits

Related questions

0 votes
1 answer
0 votes
1 answer
asked Jul 25, 2019 in DevOps and Agile by chandra (29.3k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers!

28.4k questions

29.7k answers

500 comments

94k users

Browse Categories

...