如何查看Git提交中的更改? [英] How can I see the changes in a Git commit?

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

问题描述

当我执行 git diff COMMIT 时,我看到该提交和HEAD之间的更改(据我所知),但是我希望看到该单个提交所做的更改./p>

我没有在 diff / log 上找到任何明显的选项来提供输出.

解决方案

要查看特定 COMMIT 哈希的差异,其中 COMMIT 是提交的哈希:

git diff COMMIT〜COMMIT 将向您显示 COMMIT 的祖先和 COMMIT 之间的区别.有关该命令和 git diff 的手册页./jk.gs/gitrevisions.html"rel =" noreferrer> gitrevisions 关于表示法及其朋友.

或者, git show COMMIT 将执行非常相似的操作.(提交的数据,包括其差异-但不包括合并提交.)请参见 git show联机帮助页

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.

解决方案

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.

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

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