实际上我正在尝试获取有关 merge 冲突的报告。我使用 'git blame' 查看谁更改了哪一行,但找不到分支和存储库名称信息。
有没有办法从“git blame”或“commit ids”中找到文件的存储库名称、分支名称和作者姓名,以便每当发生 merge 冲突时,我都可以向触及该文件的作者发送电子邮件文件/行来解决它。
最佳答案
git blame
应该只给你修订和作者,但是:
- 如“Git: Finding what branch a commit came from”中所述,即使
git branch --contains <commit>
,您也无法轻易查明提交的分支(分支可以重命名、移动、删除...)是一个开始。 - 我怀疑您能否找到它来自的存储库(除非可能通过仔细查看
git log
结果,试图找到来自ref/remotes
命名空间的该提交的父级)。
现在如果你有一个合适的 .mailmap
在存储库的顶层,您还将拥有正确的电子邮件地址。
In the simple form, each line in the file consists of a canonical real name of an author, a whitespace, and an email address used in the commit (enclosed by
<
and>
) to map to the name. For example:
Proper Name <commit@email.xx>
关于git - 从提交 ID 中查找 git 分支或分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2846843/