问题
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