【发布时间】:2020-01-07 14:50:31
【问题描述】:
我想在 git 分支中获取给定作者的提交消息历史记录。除了通过编程解析日志,还有什么简单的方法可以实现吗?
更新:
以下是为我做同样事情的解释:
git log --author='some author' --pretty=oneline --abbrev-commit
git log --author='some author' --oneline
git log --help 提到以下内容:
Commit Formatting
--pretty[=<format>], --format=<format>
Pretty-print the contents of the commit logs in a given format, where <format> can be one of oneline, short, medium, full, fuller, email, raw and
format:<string>. See the "PRETTY FORMATS" section for some additional details for each format. When omitted, the format defaults to medium.
Note: you can specify the default pretty format in the repository configuration (see git-config(1)).
--abbrev-commit
Instead of showing the full 40-byte hexadecimal commit object name, show only a partial prefix. Non default number of digits can be specified
with "--abbrev=<n>" (which also modifies diff output, if it is displayed).
This should make "--pretty=oneline" a whole lot more readable for people using 80-column terminals.
--no-abbrev-commit
Show the full 40-byte hexadecimal commit object name. This negates --abbrev-commit and those options which imply it such as "--oneline". It also
overrides the log.abbrevCommit variable.
--oneline
This is a shorthand for "--pretty=oneline --abbrev-commit" used together.
【问题讨论】:
-
你到底是什么意思?特定作者提交的所有提交消息?
-
@jonrsharpe 更改为消息。谢谢。