git - 如何在 git 分支中获取给定作者的提交消息历史记录?
问题描述
我想在 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.
解决方案
git log --author=<author>
如果说你正在寻找亚当布朗提交
git log --author="adam"
git log --author=adam
git log --author=Brown
也可以。如果您不需要任何空格,引号是可选的。
添加 --all 如果您打算搜索所有分支,而不仅仅是在您的存储库中搜索当前提交的祖先。
因此,要列出 adam 或 damian 的提交,您可以执行如下的正则表达式:
git log --author="\(damian\)\|\(adam\)"
或者
git log --committer="\(damian\)\|\(amit\)"
推荐阅读
- javascript - 在图像的特定位置绘制黑点
- javascript - 在 app.get(...) 中表达未定义的变量
- python - 如何在每天之后汇总总数
- flutter - 如何通过按下按钮与 UI 和异步功能进行交互?
- json - 在 API 中返回 JSON + 二进制文件的 RESTful 方式是什么
- google-cloud-platform - 无法使用 terraform 启动谷歌计算实例
- regex - Powershell Regex 验证计算机名称
- iterator - Julia:从迭代器输出制作数据框
- reactjs - 用于处理服务器响应的 React 和 React Native 模式
- angularjs - bower 生成 es6 导出格式 Uncaught ReferenceError: angular is not defined