Git: List Remote Branches

To checkout a remote branch in Git, first of all it is required to figure out what branches exist on a remote Git repository.

By default, the git branch command lists the local branches only.

In this short note i’ll show how to list only remote branches in Git and also how to list all remote and local branches.

Cool Tip: Compare branches in Git using the git diff command! Read more →

Git – List Remote Branches

Make sure that you have the latest branch list from the remote repository locally:

$ git fetch --all
Option Description
--all Fetch all remotes

Use the following Git command to see all the remote branches:

$ git branch -r

List all the remote and local branches:

$ git branch -a
Option Description
-a, --all List both remote-tracking branches and local branches
-r, --remotes List the remote-tracking branches

Cool Tip: Create a new Git branch and checkout in one command! Read More →