The best answers to the question “Git: How do I list only local branches?” in the category Dev.
git branch -a shows both remote and local branches.
git branch -r shows remote branches.
Is there a way to list just the local branches?
just the plain command
git branch without options.
From the manpage:
With no arguments, existing branches are listed and the current branch will be highlighted with an asterisk.
One of the most straightforward ways to do it is
git for-each-ref --format="%(refname:short)" refs/heads/
This works perfectly for scripts as well.
git branch -a – All branches.
git branch -r – Remote branches only.
git branch -l
git branch – Local branches only.