显示提交的原始分支 [英] Show the original branch for a commit

查看:74
本文介绍了显示提交的原始分支的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用git-blame来查找特定的提交。现在我想找到它最初来自的分支。 (从那里,我将使用分支名称来查找特定的票据)

让我们将original branch定义为提交之前的分支分支被合并到任何其他分支。

解决方案

像其他人说的,如果您正在寻找的分支不是本地到你指责这个提交的仓库(例如只在一个遥远的开发人员的个人仓库中的一个分支),你就被搞砸了。



但是,分支是你可以看到的东西,那当然你有提交的哈希,比如 d590f2 ... ,部分答案是你可以这样做:

  $ git branch --contains d590f2 
tests
* master

然后,确认你有罪魁祸首:

  $ git rev-list tests | grep d590f2 

当然,如果 d590f2 已被合并到多个分支中,您将不得不比这更细微。


I've used git-blame to find a particular commit. Now I want to find the branch that it originally came from. (From there, I'll use the branch name to find the particular ticket)

Let's define "original branch" as "the branch to which the commit was made before the branch was merged into any other branch".

解决方案

Like the others said, if the branch you are looking for isn't local to the repository on which you are blaming this commit (e.g. a branch only in the personal repo of a distant developer), you are screwed.

But assuming that sought-after branch is something you can see, and that of course you have the commit's hash, say d590f2..., a partial answer is that you can do :

$ git branch --contains d590f2
  tests
* master

Then, just to confirm you have the culprit:

$ git rev-list tests | grep d590f2

Of course, if d590f2 has been merged in more than one branch, you will have to be more subtle than this.

这篇关于显示提交的原始分支的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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