1

I created a Visual Studio Team Services Git repository.

On my local Visual Studio 2017. I sent the project to this (first commit). All ok.

I created a local branch to modify the project, on VSTS I also created this branch too.

After the code modifications, I sent code to origin/Heineken branch and performed a pull request online.

All set ok, branch Heineken moved to master and after this Heineken was deleted in VSTS.

Now Visual Studio is lost, saying me Visual Studio Team Foundation git Branch 'Heineken' was not found in the remote repository. I don't know what to do to let my VS equated with VSTS.

Some tip?

Giulio Vian
  • 8,248
  • 2
  • 33
  • 41
Jean J. Michel
  • 561
  • 1
  • 7
  • 14

2 Answers2

2

For the reason why VS shows "Branch 'Heineken' was not found in the remote repository" is cause the branch Heineken was deleted in remote repo but not delete in the local repo.

Steps to equalize the local repo with VSTS git repo as below:

1. Delete local Heineken branch

First, you can checkout to a different branch (such as checkout to master branch), then delete the local Heineken branch (right click the local Heineken branch in VS and delete).

enter image description here

2. Update remote branch to prune the VSTS git repo deleted branch Heineken

To prune the branch Heineken which deleted in remote repo, you can follow any of below options.

  • Pruned by git command line:

    In the local git repo directory, you can execute the command:

    git fetch -p
    

    So the deleted branch Heineken will be moved from remotes/origin.

  • Pruned in VS:

    In Team Explorer -> Settings -> Global Settings -> Set the option Prune remote branches during fetch as True -> update.

    enter image description here

    Then click fetch (such as in Team Explorer -> sync -> fetch), and the deleted branch Heineken won't be shown under remotes/origin any more.

Marina Liu
  • 36,876
  • 5
  • 61
  • 74
0

This is a common Git trap, see How do you stop tracking a remote branch in Git? for a full answer. The short answer is to open a command prompt and type

git checkout Heineken
git branch --unset-upstream
Giulio Vian
  • 8,248
  • 2
  • 33
  • 41