List git branches
If you need to enumerate branches in a shell-script, git branch
sucks: you need to cut, remove a star, etc.
Here is better solution:
git for-each-ref refs/heads/ --format='%(refname:short)'
Took from Stack Overflow question: How can I get a list of git branches, ordered by most recent commit?.
See git-for-each-ref man page for more options.
Written by Alexey Alekhin
Related protips
Have a fresh tip? Share with Coderwall community!
Post
Post a tip
Best
#Shell
Authors
Sponsored by #native_company# — Learn More
#native_title#
#native_desc#