哪个git分支指向当前提交? [英] Which git branches point to the current commit?

查看:89
本文介绍了哪个git分支指向当前提交?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当前,如果我想知道指向当前提交的分支,则使用

Currently, if I want to know the branches that point at the current commit, I use

git show-ref | grep "<SHA1>"

<SHA1>是当前提交.

这会产生类似

<SHA1> refs/heads/branch-name1
<SHA1> refs/heads/branch-name2
<SHA1> refs/remotes/origin/branch-name1

有没有更简单的方法来获取指向当前提交的分支?类似于

Is there a simpler way to get the branches that point to the current commit? Something similar to

git-ideal-command-without-parameters

哪个生产

branch-name1
branch-name2
origin/branch-name1

?

推荐答案

git branch --points-at HEAD

HEAD 是对当前已检出提交的引用.

HEAD is a reference to the currently checked out commit.

有关详细信息,请参见git-branch .

这篇关于哪个git分支指向当前提交?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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