Skip to content

Home

View all Git branches

To view a list of all branches in a Git repository, you can use the git branch command. You may want to do so to see what work is in progress, what branches are available for you to switch to, or to get an overview of the repository's structure.

View all local branches

You can use git branch to display a list of all local branches. As usual, you can use the arrow keys to navigate the list and press Q to exit.

# Syntax: git branch

git branch
# master
# patch-1
# patch-2

View all remote branches

Similarly, you can use git branch -r to display a list of all remote branches. You can use the same navigation keys and exit key as before.

# Syntax: git branch -r

git branch -r
# origin/master
# origin/patch-1
# origin/patch-2

More like this

Start typing a keyphrase to see matching snippets.