首页 > 解决方案 > git ls-remote --heads 忽略特定分支

问题描述

git ls-remote --heads 显示远程分支中可用的引用以及相关的提交 ID。

git ls-remote --heads https://github.com/companyname/gitreponame release/branchname-

它给了我所有远程分支的列表,如下所示

有没有办法可以从我的列表中忽略这些-TP bnranches

标签: github

解决方案


git ls-remote不提供内置的方法来做到这一点,但你可以很容易地做到这一点grep

$ git ls-remote --heads origin | grep -ve '-TP$'

推荐阅读