如何获取某些远程起源分支的所有名称?Git特定远程分支名称列表
我开始从--remote --list
选项,但得到多余的origin/HEAD -> origin/master
消息和分支从另一个来源。具体产地
$> git branch --remote --list
origin/HEAD -> origin/master
origin1/develop
origin1/feature/1
origin1/feature/2
origin1/feature/3
origin1/master
origin2/develop
origin2/feature/1
origin2/feature/2
origin2/master
分行可以与<pattern>
选项相匹配,但是多余的信息仍然存在。实际上,这种模式并不是真的正确,因为某些原点的名称可能是另一个原点名称的子串,甚至是某个分支。
$> git branch --remote --list origin1*
origin1/HEAD -> origin/master
origin1/develop
origin1/feature/1
origin1/feature/2
origin1/feature/3
origin1/master
什么是我寻找的是的origin1
分支机构的名单,其中任何一个我可以用git checkout
命令。类似的东西:
develop
feature/1
feature/2
feature/3
master
重要的是,它应该没有grep
,sed
,tail
甚至ghc -e
包装来完成,只有真正git
力量,因为他们unsafeness和变异。
看起来不错。感谢您的详尽答复。 – 2012-04-09 17:33:40
我也可以回答这个问题,但是“no sed”规则发生了什么?大声笑,无论 – KurzedMetal 2012-04-09 19:10:14
@KurzedMetal是真实的,但我仔细证明使用'sed'只使用管道命令,而不是像'git branch'这样的瓷器命令。请参阅http://stackoverflow.com/questions/2978947/how-to-list-all-the-log-for-current-project-in-git/2979124#2979124或http://stackoverflow.com/questions/2976665/git-changelog -day-by-day/2976776#2976776 – VonC 2012-04-09 21:06:31