By default git branch
will list all of your local branches with an asterisk (*
) in front of the current branch.
e.g.
$ git branch
develop
* feature/my-new-feature
main
Why Remove the Asterisk
When writing a script to automate some behavior, it can be helpful to not have the asterisk.
How to Remove the Asterisk
Adding --format='%(refname:short)
will define the output format (see more information on format).
e.g.
$ git branch --format='%(refname:short)'
develop
feature/my-new-feature
main
Leave a Reply