How do I list all remote branches in Git 1.7+?

47    Asked by OkamotoBando in Devops , Asked on Aug 16, 2025

How can you view all remote branches in Git version 1.7 and above? What commands let you check which branches exist on the remote repository versus your local setup?

Answered by Juiako

To list all remote branches in Git (version 1.7+), you can use a few simple commands. Remote branches are those that exist on your remote repository (like GitHub, GitLab, or Bitbucket) but may or may not exist locally on your system. Knowing how to list them helps you keep track of what’s available to fetch, track, or work on.

Here are the most common ways to do it:

Basic Command to List Remote Branches

 git branch -r

  •  This shows all branches that exist on the remote but not necessarily on your local repository.

List Both Local and Remote Branches

 git branch -a

  •  With this command, you’ll see local branches (without prefixes) and remote branches (usually prefixed with remotes/origin/).

Fetch Updates Before Listing

 Sometimes, your remote branch list may be outdated. Run:

 git fetch --all

  •  Then check again with git branch -r to get the latest remote branches.

Get More Details

 If you want more info about remotes:

 git remote show origin

 This shows tracked branches and additional remote-tracking details.

In summary, the easiest way to list all remote branches in Git 1.7+ is by using git branch -r or git branch -a. Pair this with git fetch --all to ensure you’re seeing the most up-to-date information.



Your Answer

Interviews

Parent Categories