As with most things in Git, there are multiple ways to list branches. You don’t want to waste any time browsing GitHub or GitLab for sure, hence running Git commands from the CLI is the preferred, most efficient and fastest way to get work done.
Prerequisites
- Git
Solution
List local branches only:
git branch
List remote branches only:
git branch -r
git ls-remote --heads
git show-branch -r
To list all branches local and remote, run:
git branch -a
Conclusion
To find more neat Git commands and hacks, browse the Git category. Feel free to leave a comment below and if you find this tutorial useful, follow our official channel on Telegram.