List all local git branches without an asterisk [duplicate]

别等时光非礼了梦想. 提交于 2019-12-08 16:08:55

问题


If I run git branch, I get something like:

* master
  dev
  foo

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.


回答1:


You can use for-each-ref:

git for-each-ref --format='%(refname:short)' refs/heads/*


来源:https://stackoverflow.com/questions/51696931/list-all-local-git-branches-without-an-asterisk

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!