我有一个提交c,我想获取该提交的变更集和元信息,而不是其他任何提交。有没有比git log -p c^..c
更简单的方法来做到这一点?
Michal Trybus的回答是最简单易懂的。但如果你不想在输出中显示差异,你总是可以采取以下方法:
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 <zedoo@stackoverflow.com>
Date: Thu Aug 2 {time-stamp}
{short description}
D zedoo/foo.py
A zedoo/bar.py
git show --name-only <sha1>
命令! - dbngit show -s <commit>
。 - moeffjugit help log
输出,或者参考https://git-scm.com/book/en/v2/Git-Basics-Viewing-the-Commit-History#limit_options。`-<number>`可以限制输出的提交数量。 - LarsHgit show --stat <commit>
。 - B.Z.git log -p c -1
就是做这件事。
git show $sha
完全相同。 - kengit log --grep='part_of_description' -p
在 git log --grep='part_of_description'
中选择包含“part_of_description”的提交,并使用 -p
显示每个提交的更改集。
git show
本身顯示當前分支中最新的單個提交。 - James Moore