如何查看git commit中的更改? [英] How to see the changes in a git commit?

查看:138
本文介绍了如何查看git commit中的更改?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我执行 git diff COMMIT 时,我看到了该提交与HEAD(afaik)之间的更改,但我希望看到该单一提交所做的更改。



我在diff / log上没有发现任何明显的选项可以给我输出。

解决方案

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



git diff COMMIT ^ COMMIT 会显示 COMMIT 的祖先和 COMMIT code>。有关该命令的详细信息,请参阅 git diff 的手册页, gitrevisions 关于 ^ 表示法及其朋友。

另外, git show COMMIT 会做类似的事情。 (提交的数据,包括其差异)请参阅 git show手册页


When I do git diff COMMIT I see the changes between that commit and HEAD (afaik) 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.

解决方案

To see the diff for a particular COMMIT hash:

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.) See the git show manpage.

这篇关于如何查看git commit中的更改?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆