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

Published by Daniyal Hamid. Daniyal currently works as the Head of Engineering in Germany and has 20+ years of experience in software engineering, design and marketing.