列出所有本地的git分支(不带星号) [英] List all local git branches without an asterisk
本文介绍了列出所有本地的git分支(不带星号)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如果我运行git branch
,我会得到类似的东西:
If I run git branch
, I get something like:
* master
dev
foo
如果执行git branch -r
,它将显示遥控器上的所有分支,没有星号(星号显示我当前已签出的分支).
if I do git branch -r
, it will show all branches on the remote, without an asterisk (where the asterisk shows my current checked-out branch).
如何在不显示星号的情况下列出所有本地分支机构?我需要一个程序化的解决方案,以便可以逐行读取结果.
How can I list all the local branches, without an asterisk showing up? I need a programmatic solution so I can read in the results line-by-line.
推荐答案
您可以使用 for-each-ref
:
You can use for-each-ref
:
git for-each-ref --format='%(refname:short)' refs/heads/*
这篇关于列出所有本地的git分支(不带星号)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文