Explore Courses Blog Tutorials Interview Questions
0 votes
in Azure by (5.8k points)

After we move from TFS VC to Git as the repository on our VSO subscription, we got the following cenario.

From a given remote repository on VSO named "RepoA", after the initial clone, it presents on team explorer to me the "main" branch for this repo.

Then I created a branch "myBranch" from the "main" branch locally. Made some changes to the code, and then commit > Publish the branch to VSO.

Now if I go to VSO portal, on the code tab, I can see "myBranch" along with "main" branch there.

So, if someone else on my team clone the "RepoA" or if they already had it cloned, they fetch from team explorer, they will see the remote branchs on Branchs topic at team explorer. That is ok...

Now, if I go to the VSO portal, and open a Pull Request from "myBranch" -> "master", someone review it, approve it, click on Complete request and then click on Delete source branch, the branch will disappear from server(which is the expected behavior by click on that button).

The problem is that if I fetch changes, the branch does not desappear from my local branches(the blue circle) neither from remotes/origin(the branches on the red circle) on team explorer/branches guide.

team explorer git

What we need is, when someone delete a remote branch on VSO (the branches on the red circle) they need to be removed automatically(or by fetch command) from the remotes/origin "folder" on team explorer.

We know that local branches(the blue circle) must be deleted manually, so, how to keep Team Explorer synced with the changes made by me and others on VSO portal while using Git as repository?

If this is by design of Git "way" and its my Git nubish, please let me know and I'll definetivelly open a feature request on VSO/VS teams user voice to have something "extra" implemented on team explorer the same way it has the "Sync" button which is a VS feature, not a Git one.

1 Answer

0 votes
by (9.6k points)

You are looking for the fetch command to also prune, but that is not supported at present in VSO. You can do it using git config remote.origin.prune true.

Browse Categories