单个修订版的git日志

问题描述 投票:157回答:3

我有一个提交c。我想得到那个确切的提交c + metainformation的变更集而不是其他的。有没有比git log -p c^..c更简单的方法呢?

git git-log
3个回答
246
投票

你可以使用show

git show commit_id

53
投票

Michal Trybus的回答是最简单的。但是如果你不想在输出中使用diff,你总是可以这样做:

git log -1 -U c

这将为您提供提交日志,然后您将完全控制所有git日志记录选项以实现自动化目的。在你的实例中,你说你想要改变集。最容易实现的方法是:

git log --name-status --diff-filter="[A|C|D|M|R|T]" -1 -U c

或者,如果你使用的git版本大于1.8.X,它将是:

git log --name-status --diff-filter="ACDMRT" -1 -U c

这将给您类似的结果:

commit {c}
Author: zedoo <[email protected]>
Date: Thu Aug 2 {time-stamp}

   {short description}
D    zedoo/foo.py
A    zedoo/bar.py

当然,您可以过滤掉您认为合适的事件,并根据需要通过传统的git-log命令格式化返回,这些命令记录良好的here


13
投票

git log -p c -1就是这么做的。

© www.soinside.com 2019 - 2024. All rights reserved.