单个修订的 git 日志
我有一个提交 c.我想要获取该确切提交 c + 元信息的变更集,而不是其他变更集。有没有比 git log -pc^..c 更简单的方法来做到这一点?
I have a commit c. I want to get the changeset of that exact commit c + metainformation and no other one. Is there a simpler way than git log -p c^..c
to do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
Michal Trybus 的回答是最简单的。但是,如果您不希望输出中存在差异,您始终可以执行以下操作:
这将为您提供提交日志,然后您将可以完全控制所有 git 日志记录选项以实现自动化目的。在你的例子中,你说你想要变更集。最容易理解的实现方法是:
或者,如果您使用的 git 版本大于 1.8.X,则为:
这将为您提供类似于以下内容的结果:
当然,您可以过滤掉您认为合适的任何事件,并通过传统的 git-log 命令按照您的意愿格式化返回值,这些命令有详细记录 这里。
Michal Trybus' answer is the best for simplicity. But if you don't want the diff in your output you can always do something like:
That will give you the commit log, and then you'll have full control over all the git logging options for your automation purposes. In your instance you said you wanted the change-set. The most human-readable way to accomplish that would be:
Or, if you're using a git version greater than 1.8.X it would be:
This will give you results similar to:
Of course you can filter out whichever events you see fit, and format the return as you wish via the traditional git-log commands which are well documented here.
git log -pc -1 就是这么做的。
git log -p c -1
does just that .您可以通过提交描述来过滤更改:
其中
git log --grep='part_of_description'
选择包含“part_of_description”的提交,-p
显示以下内容的变更集每次提交You can use to filter change by description of commit:
where
git log --grep='part_of_description'
select the commits that contains 'part_of_description' and-p
show the changeset of each commit您可以使用
show
:You can use
show
: