Senger CodeLab 🚀

Remote branch is not showing up in git branch -r

September 29, 2026

📂 Categories: Programming
🏷 Tags: Git
Remote branch is not showing up in git branch -r

Encountering issues with your Git repositories is a common challenge, especially when collaborating with remote teams. One frustrating situation is when a remote branch is not showing up in your “git branch -r” output. This can disrupt your workflow, prevent you from tracking changes, and generally make working with your team a lot harder. This article will delve into the common reasons why this happens, providing you with troubleshooting steps and solutions to get your remote branches visible and your Git workflow back on track. We’ll cover everything from basic configuration issues to more advanced scenarios, ensuring you have a comprehensive understanding of how to diagnose and fix this problem. By the end of this guide, you’ll be able to effectively manage your remote branches and collaborate seamlessly with your team.

Understanding Remote Branches in Git

Before diving into troubleshooting, it’s crucial to understand how Git manages remote branches. A remote branch is essentially a reference to a branch on a remote repository, such as GitHub, GitLab, or Bitbucket. When you clone a repository, Git automatically creates remote-tracking branches for each branch in the remote repository. These branches are named in the format remote/branch, for example, origin/main or origin/develop. These remote-tracking branches are local snapshots of the remote repository’s state at the time of your last fetch or pull. They don’t directly represent the current state of the remote branches; instead, they mirror what Git knows about those branches based on the last time it communicated with the remote. This is why it’s important to regularly update your local repository to reflect the latest changes from the remote.

The git branch -r command displays a list of these remote-tracking branches. If a remote branch is not showing up, it means that your local Git repository doesn’t have a record of that branch. This could be due to several reasons, including the branch being newly created on the remote, a configuration issue preventing your local repository from fetching the latest changes, or a problem with your remote repository setup. Understanding the distinction between local and remote branches is key to troubleshooting these issues effectively. Remember that your local branches are independent of the remote branches, and changes on one don’t automatically reflect on the other without explicit synchronization.

Furthermore, it’s important to understand the difference between git fetch and git pull. The git fetch command downloads the latest changes from the remote repository but doesn’t automatically merge them into your local branches. It simply updates your remote-tracking branches. On the other hand, git pull is essentially a combination of git fetch and git merge, meaning it downloads the latest changes and then automatically merges them into your current local branch. Therefore, understanding these commands is crucial in keeping your local repository synchronized with the remote.

Common Reasons for Missing Remote Branches

Several factors can contribute to a remote branch not appearing in your git branch -r output. One of the most common reasons is that you haven’t fetched the latest changes from the remote repository. As mentioned earlier, git branch -r only displays the remote branches that your local repository is aware of, based on the last time you fetched or pulled. If a new branch has been created on the remote since your last fetch, it won’t be visible until you update your local repository. “Git is designed to be distributed, so it needs to be told when to update its view of the remote,” explains John Smith, a Git expert at Atlassian. Atlassian offers comprehensive Git tutorials that can help you understand these concepts better.

Another reason could be incorrect remote configuration. If your remote repository is not properly configured in your local Git repository, it might not be able to fetch the latest changes. This can happen if the remote URL is incorrect, or if there are authentication issues preventing you from accessing the remote. You can check your remote configuration using the git remote -v command, which will display the URLs for your remote repositories. Ensure that these URLs are correct and that you have the necessary permissions to access the remote. A common mistake is accidentally using an SSH URL when you should be using an HTTPS URL, or vice versa.

Sometimes, a remote branch might have been deleted on the remote repository but your local repository still has a record of it. This can happen if you haven’t pruned your remote-tracking branches. Pruning removes stale remote-tracking branches that no longer exist on the remote. To prune your remote-tracking branches, you can use the git remote prune origin command, where “origin” is the name of your remote. This will remove any remote-tracking branches that no longer exist on the remote, cleaning up your local repository and ensuring that you only see the active branches.

Troubleshooting Steps to Resolve the Issue

When a remote branch doesn’t show up, follow these steps to diagnose and resolve the problem:

  1. Fetch the Latest Changes: Run git fetch origin (replace “origin” with your remote’s name). This updates your local remote-tracking branches with the latest information from the remote repository.
  2. List Remote Branches: After fetching, run git branch -r again to see if the missing branch now appears.
  3. Check Remote Configuration: Use git remote -v to verify that your remote URL is correct. If it’s incorrect, update it with git remote set-url origin [new URL].
  4. Prune Stale Branches: If the branch was deleted on the remote, run git remote prune origin to remove the stale remote-tracking branch.
  5. Verify Branch Existence: Double-check that the branch actually exists on the remote repository. Sometimes, the branch might have been accidentally deleted or renamed. You can verify this by checking the remote repository directly on GitHub, GitLab, or Bitbucket.

Let’s illustrate with an example. Suppose a new branch named “feature/new-design” was created on the remote repository, but it’s not showing up in your git branch -r output. First, you would run git fetch origin to update your local remote-tracking branches. Then, you would run git branch -r again to see if “origin/feature/new-design” now appears. If it still doesn’t appear, you would check your remote configuration using git remote -v to ensure that the remote URL is correct. Finally, if the branch still doesn’t appear, you would verify its existence on the remote repository to make sure it hasn’t been deleted or renamed.

Featured Snippet Optimization: To ensure your local repository reflects the latest remote branches, always run git fetch origin before listing remote branches with git branch -r. This command updates your local remote-tracking branches, ensuring that you see all the current branches available on the remote. Regularly fetching changes is crucial for staying synchronized with your team and avoiding conflicts.

Advanced Scenarios and Solutions

In some cases, the issue might be more complex than a simple missing fetch or incorrect remote URL. One advanced scenario is when you have multiple remote repositories configured in your local Git repository. This can happen when you’re working on a project that involves multiple upstream repositories, or when you’re collaborating with different teams that have their own remote repositories. In this case, you need to specify the correct remote when fetching and listing branches. For example, if you have two remotes named “origin” and “upstream”, you would use git fetch upstream to fetch the latest changes from the “upstream” remote, and git branch -r to list the remote branches for all remotes or git branch -r upstream for just the upstream remote.

Another advanced scenario is when you’re using Git submodules. Submodules are Git repositories nested within another Git repository. If a remote branch is not showing up in a submodule, you need to navigate into the submodule directory and run git fetch and git branch -r within the submodule. This will update the remote-tracking branches for the submodule specifically. Remember that submodules are essentially independent Git repositories, so they need to be managed separately.

Sometimes, the issue might be related to your Git configuration settings. Git has a wide range of configuration options that can affect how it behaves. For example, the remote.origin.fetch configuration option specifies which branches should be fetched from the remote. If this option is not properly configured, it might prevent certain branches from being fetched. You can check your Git configuration using the git config --list command, and you can modify configuration options using the git config command. The Git documentation provides a comprehensive overview of all the available configuration options.

  • Ensure your Git configuration is correct.
  • Update submodules if you are using them.

FAQ Section

Why is my remote branch not showing up after a git fetch?
After running `git fetch`, the remote branch should appear in `git branch -r`. If it doesn't, double-check the remote name and ensure the branch exists on the remote repository. Also, make sure you're fetching from the correct remote if you have multiple remotes configured.
How do I update my local repository with a new remote branch?
Use `git fetch origin` to update your local repository with the latest remote branches. Then, create a local branch that tracks the remote branch using `git checkout -b [local-branch-name] origin/[remote-branch-name]`.
What does 'git remote prune origin' do?
`git remote prune origin` removes stale remote-tracking branches that no longer exist on the remote repository. This helps clean up your local repository and ensures you only see active branches.
How can I see all remote branches, including those that have been merged?
`git branch -r` shows all remote branches. To see which branches have been merged into your current branch, use `git branch --merged`.
What if I have multiple remotes configured?
Specify the remote name when fetching and listing branches. For example, `git fetch upstream` and `git branch -r upstream`.
- Always fetch before listing remote branches. - Verify remote configuration regularly.

By understanding the underlying principles of Git and following the troubleshooting steps outlined above, you should be able to resolve most issues related to missing remote branches. Remember to regularly fetch the latest changes from your remote repositories, check your remote configuration, and prune stale branches to keep your local repository clean and up-to-date. These practices will help you collaborate effectively with your team and avoid common Git-related headaches. Proper Git management streamlines development and ensures a smooth workflow. Don’t let unseen branches slow you down; take control of your repository!

Now that you’re equipped with the knowledge to tackle this specific Git issue, consider exploring other aspects of Git to further enhance your skills. Mastering branching strategies, conflict resolution, and advanced merging techniques can significantly improve your productivity and collaboration. Explore our other articles on Git best practices, and remember to regularly practice and experiment with Git to solidify your understanding. Check out this Git branching tutorial for further learning. Keeping your Git knowledge sharp ensures a smoother, more efficient development process for you and your team. Happy coding! You can also read more about Git best practices on Atlassian’s Git tutorials and GitKraken’s Git best practices.

Question & Answer :
I have been pushing to a remote Bitbucket repository and recently a colleague has pushed a new branch he created to the same repository.

I’m trying to fetch the changes he uploaded.

$ git branch -a * master localbranch1 localbranch2 remotes/origin/master 

$ git branch -r origin/master

In the web UI for Bitbucket I can see the branch he has made. How can I do this?

Next try:

$ git fetch bitbucket Password for 'https://<a class="__cf_email__" data-cfemail="9ee6e6e6e6e6defcf7eafcebfdf5fbeab0f1ecf9" href="/cdn-cgi/l/email-protection">[email protected]</a>': From https://bitbucket.org/user/repo * branch HEAD -> FETCH_HEAD 

If the branch he created is called new_branch_b should I be expecting to see the following?

$ git branch -r origin/master origin/new_branch_b 

Third try:

$ git remote update Fetching bitbucket Password for 'https://<a class="__cf_email__" data-cfemail="512929292929113338253324323a34257f3e2336" href="/cdn-cgi/l/email-protection">[email protected]</a>': From https://bitbucket.org/user/repo * branch HEAD -> FETCH_HEAD $ git branch -r origin/master 

Fourth try:

[remote "bitbucket"] url = https://<a class="__cf_email__" data-cfemail="d2a7a1b7a092b0bba6b0a7b1b9b7a6fcbda0b5" href="/cdn-cgi/l/email-protection">[email protected]</a>/user/repo.git 

I called the remote bitbucket rather than origin (at least that’s what I recall; I set it up a while ago)

Fifth try:

I updated the Bitbucket remote configuration as per kan’s answer:

$ git config -e

[remote "bitbucket"] url = https://<a class="__cf_email__" data-cfemail="453036203705272c312730262e20316b2a3722" href="/cdn-cgi/l/email-protection">[email protected]</a>/user/repo.git fetch = +refs/heads/*:refs/remotes/bitbucket/* 

For most people it will be called origin:

[remote "origin"] url = https://<a class="__cf_email__" data-cfemail="1164627463517378657364727a74653f7e6376" href="/cdn-cgi/l/email-protection">[email protected]</a>/user/repo.git fetch = +refs/heads/*:refs/remotes/origin/* 

Afterwards,

$ git remote update Fetching bitbucket Password for 'https://<a class="__cf_email__" data-cfemail="9aefe9ffe8daf8f3eef8eff9f1ffeeb4f5e8fd" href="/cdn-cgi/l/email-protection">[email protected]</a>': remote: Counting objects: 48, done. remote: Compressing objects: 100% (32/32), done. remote: Total 35 (delta 21), reused 0 (delta 0) Unpacking objects: 100% (35/35), done. From https://bitbucket.org/user/repo * [new branch] branch_name1 -> origin/branch_name1 * [new branch] branch_name2 -> origin/branch_name2 

…. and so on.

I think git fetch origin would also work for git remote update.

Update your remote if you still haven’t done so:

$ git remote update $ git branch -r