从commit id查找git分支或分支 [英] Find the git branch or branches from commit id

查看:1542
本文介绍了从commit id查找git分支或分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

其实我试图得到合并冲突的报告。我使用'git blame'来查看谁改变了哪一行,但我找不到分支和存储库名称信息。



有没有办法找到存储库名称,分支名称和来自'git blame'或提交id'的文件的作者姓名,以便每当发生合并冲突时,我都可以发送电子邮件给已触及该文件/行以解决该问题的作者。

解决方案

git blame 应该只给你修订版和作者,但是:


  • 详见 Git :找到一个提交来自哪个分支,即使 git分支,您也无法轻易找到提交进行的分支(分支可以被重命名,移动,删除...) --contains< commit> 是一个开始。
  • 我怀疑你可以找到它来自的存储库(除非通过仔细观察 git log 结果,试图找到这是来自 ref / remotes 命名空间的提交的父代)。


现在,如果您在存储库顶层有适当的 .mailmap ,那么您将拥有正确的电子邮件地址。


在简单的表单中,文件中的每一行都包含一个作者的标准真实姓名,一个空格和一个用于提交的电子邮件地址(由 < > )映射到名称。例如:



 正确名称< commit@email.xx> 


Actually am try to get a report on merge conflicts. I used 'git blame' to see who has changed what line, but i couldn't find the branch and repository name information.

Is there a way to find the repository name, branch name and author name of a file from 'git blame' or from commit ids' so that whenever a merge conflict occurs i can send an email to the authors who have touched that file/lines to resolve it.

解决方案

git blame should only give you the revision and author, but:

  • as mentioned in "Git: Finding what branch a commit came from", you cannot easily pinpoint the branch where that commit has been made (branches can be renamed, moved, deleted...), even though git branch --contains <commit> is a start.
  • I doubt you can find the repository it came from (unless maybe by looking hard in the git log results, trying to find the parent of that commit comming from a ref/remotes namespace).

Now if you have a proper .mailmap at the toplevel of the repository, you will have the right email addresses as well.

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>

这篇关于从commit id查找git分支或分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆