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

Categories

0 votes
320 views
in Technique[技术] by (71.8m points)

git - 如何查看Git提交中的更改?(How to see the changes in a Git commit?)

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.

(当我执行git diff COMMIT我看到了该提交和HEAD之间的变化(据我所知),但我希望看到该单个提交所做的更改。)

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

(我没有在diff / log上找到任何明显的选项,它会给我输出。)

  ask by laktak translate from so

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

1 Answer

0 votes
by (71.8m points)

To see the diff for a particular COMMIT hash:

(要查看特定COMMIT哈希的差异:)

git diff COMMIT~ COMMIT will show you the difference between that COMMIT 's ancestor and the COMMIT .

(git diff COMMIT~ COMMIT将显示COMMIT的祖先和COMMIT之间的区别。)

See the man pages for git diff for details about the command and gitrevisions about the ~ notation and its friends.

(有关命令和gitrevisions有关~符号及其朋友的详细信息,请参阅git diff的手册页。)

Alternatively, git show COMMIT will do something very similar.

(或者, git show COMMIT会做一些非常相似的事情。)

(The commit's data, including its diff - but not for merge commits.) See the git show manpage .

((提交的数据,包括它的差异 - 但不适用于合并提交。)请参阅git show联机帮助页 。)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...