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.
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.
Thanks! Really appreciate any help, clarifications.
The Sync button is available on the Team Explorer pane and and also displayed after you create a commit using the extension. The sync tool enables you to select how you want to update the project: sync: performs a git pull and a git push .
For more information on Sync, see Use git fetch, pull, push and sync for version control in Visual Studio. Open the Team Explorer and open the Sync view. Then select the Pull link under Incoming Commits to pull remote changes and merge them into your local branch.
To do that in Visual Studio, first make sure to fetch and get the latest updates from your remote repository Git > Fetch. Then right click on the remote branch you would like to review and select Checkout Tip Commit.
I am currently in a project that uses TFS Git as the code repository. In Visual Studio, under Team Explorer -> Sync, there is an option called Sync. Now I am familiar with the Fetch, Pull, and Push actions but Sync is new to me.
You can see in Team Explorer there are two Visual Studio Version Control providers, one is Visual Studio Team Services; i.e., TFS, and the second is Git. But none of them are connected in the Team Explorer.
If you are having trouble to see the newly created (remote) git branches in the Visual Studio Team Explorer, try the workaround provided in this article. In our company, all the projects source code is under source control, which is Visual Studio Online (VSO). And most of them are using GIT as the version control (VSO supports Git as well as TFS).
How you use Team Explorer to connect to a project depends on the version of Visual Studio 2019 you're using. Open Visual Studio 2019. On the start window, select Clone a repository. In the Browse a repository section, select Azure DevOps.
What you are looking for is for the fetch
command to also prune
, but this is not supported at present in VSO. As a workaround, you can configure git to always prune
by default whenever you do a git fetch
. You can do this using git config remote.origin.prune true
See this thread for details, Automatic prune with git fetch or pull
Also, it might help if you can upvote the below feature request at user voice :-)
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/7204022-visual-studio-git-propose-to-prune-when-fetchi
http://visualstudio.uservoice.com/forums/121579-visual-studio/suggestions/7744350-add-pruning-of-a-git-remote-to-the-team-explorer
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With