How to List All Local and/or Remote Git Branches?

To list only local git branches, you can use the git branch command without any flags:

git branch # list all local branches only

To list only the remote branches, you can pass the -r flag to the git branch command:

git branch -r # list all remote branches only

To list all branches (including all remote and local ones), you can pass the -a flag to the git branch command:

git branch -a # list all remote and local branches

Hope you found this post useful. It was published . Please show your love and support by sharing this post.