如何从commit id找到分支 [英] How to find the branch from commit id

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

问题描述

所以,我试图找到一个给定提交的分支名称。 ( c853d8cf3ae34dae9866b874b96c6529515d7e90



我有在git问题上引用的父id和提交id。 $ b怎样才能找到给定的提交ID被推入' x '分支?

解决方案

在GitHub上,您现在可以查看给定提交所属的分支。

博客文章。



不要忘记提交可以是多个分支的一部分。 / p>

So, I am trying to find branch name in which a given commit was made. (c853d8cf3ae34dae9866b874b96c6529515d7e90)

I have the parent id and commit id referenced on the git issue.
How can I find that given commit id was pushed in 'x' branch?

解决方案

On GitHub specifically, you now can see the branch a given commit is part of.
The blog post "Branch and Tag Labels For Commit Pages" details:

If the commit is not on the default branch, the indicator will show the branches which contain the commit.
If the commit is part of an unmerged pull request, a link will be shown.

Once the commit makes it to the default branch, any tags that contain the commit will be shown, and the default branch will be the only branch listed.


Original answer

You can list those branches:

git branch --contains <commit>

# in your case
git branch --contains <commit> | grep x

More details in "Git: Finding what branch a commit came from".

Don't forget that a commit can be part of several branches.

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

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