Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

When I do git diff COMMIT I see the changes between that commit and HEAD (as far as I know), but I would like to see the changes that were made by that single commit.

I haven't found any obvious options on diff / log that will give me that output.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
542 views
Welcome To Ask or Share your Answers For Others

1 Answer

To see the diff for a particular COMMIT hash, where COMMIT is the hash of the commit:

git diff COMMIT~ COMMIT will show you the difference between that COMMIT's ancestor and the COMMIT. See the man pages for git diff for details about the command and gitrevisions about the ~ notation and its friends.

Alternatively, git show COMMIT will do something very similar. (The commit's data, including its diff - but not for merge commits.) See the git show manpage.

(also git diff COMMIT will show you the difference between that COMMIT and the head.)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...