0 votes
1 view
in Devops and Agile by (29.9k 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 (51.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.9k points)
Welcome to Intellipaat Community. Get your technical queries answered by top developers !


Categories

...