在 Git 中查找提交 ID 的提交日志
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/13398819/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Look up commit log for commit ID in Git
提问by Shraddha
I want to look at a commit by ID. For instance, I want to know the code that got committed for that ID, something like:
我想通过 ID 查看提交。例如,我想知道为该 ID 提交的代码,例如:
git log <commit_id>
And this would display the committed code and commit message that corresponds to this ID.
这将显示与此 ID 对应的已提交代码和提交消息。
回答by Seth Robertson
git show <commit_id>
is the droid you are looking for, probably.
可能是您正在寻找的机器人。
回答by Noitidart
@SethRobertson's solution works for me but it shows a diff. I wanted to see it exactly like git log
shows it. So add --no-patch
:
@SethRobertson 的解决方案对我有用,但它显示了一个差异。我想看到它就像git log
展示的那样。所以添加--no-patch
:
git show <commit_id> --no-patch
I learned this from - https://stackoverflow.com/a/31448684/1828637
我从 - https://stackoverflow.com/a/31448684/1828637了解到这一点