155

I have created a new Git repository on Visual Studio online. I have cloned on my computer and I have added it a project. After that, I have created a new branch called develop on Visual Studio online, and I have tried to check it out creating a new local branch but it doesn't appear on Team Explorer.

This is my Visual Studio online: enter image description here

And this is Visual Studio 2015 Team Explorer: enter image description here

Why develop branch doesn't appear on Team Explorer?

6 Answers 6

329

You can now do this in Visual Studio by going to the Synchronisation tab (Sync in the Team drop down menu) and clicking Fetch at the top.

Choose Sync from the menu, hit fetch

9
  • 13
    Thx! Just a small remark, don't you find it confusing that it states: Branch master? I then always things I am performing the action on the master branch Commented Jun 21, 2017 at 8:17
  • 3
    Agreed! That is odd. Commented Jun 21, 2017 at 8:57
  • 6
    Also note that after you click Fetch, no notification that anything has occurred is displayed. You simply go to branches afterwards and will see the missing branch.
    – Sabel
    Commented Jan 23, 2018 at 15:10
  • 9
    This should really be in the branches section and not under sync.
    – gsharp
    Commented Jul 13, 2018 at 11:08
  • 13
    Yeah, it'd be nice if the 'refresh' button on the Branches tab just did a fetch too. That was my expectation. Commented Jul 26, 2018 at 0:50
44

I have solved my problem opening a Git Command Prompt (following this instructions), and doing a git fetch to retrieve the new branch.

4
  • 3
    Doing a "pull" inside of Visual Studio should have achieved the same result if you are on the latest updates. Commented Aug 20, 2015 at 19:28
  • 2
    I have the same problem and I can confirm that - After pulling in the team explorer the missing branch appear. Thanks!
    – Lion
    Commented Sep 27, 2015 at 10:38
  • The problem here is that your local client doesn't know when the server updates; you have to pull data from it for the server to give you data. Hence a fetch is needed if a new branch is made on the server (one that you didn't make locally). If you understand client/server then it shouldn't be too.. unbelievable.
    – Dagrooms
    Commented Apr 24, 2017 at 20:31
  • I tried this, and hundreds of branch refs were downloaded, but when returning to VS2017 (latest updates) the branches are still not visible on the branches list.
    – Ryan
    Commented Dec 26, 2018 at 21:15
1

Sometimes simply clicking the fetch button will not work if there are many remote branches and depending on how it's setup. If standard fetch doesn't work try running git fetch --all from the package manager console or command line.

0

Please check the casing of the branch name.
Looks like when the visual studio first downloads the branch locally, it changes the folder name to lowercase when the local repo is created. However, for future pulls it does a case-sensitive search on the remote repo, causing a mismatch!

General guidance: If you are using a folder name for the branches, make sure you are using lowercase.

0

A blunder done by me - due to duplicate naming in different project areas...so check out... RIGHT project space, you are searching for remote!

-1

I had the exact opposite issue (more or less): I could see the branch in Visual Studio, but it wasn't on the remote server.

Trying to delete it (from remote) yielded this error:

Error encountered while pushing to the remote repository: Git failed with a fatal error. PushCommand.ExecutePushCommand

Here's how to fix it (tested in VS 2017):

  1. In Visual Studio, double click on your "rogue" remote branch;
  2. VS should have now created a local branch from it;
  3. Right click on the local branch, select "Unset remote branch";
  4. Right click on the local branch, select "Push branch";
  5. You should now have a true corresponding remote branch;
  6. Delete the remote branch, then the local branch.

Hopefully it will help someone who ends up on this thread having the same issue as me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.