How to update remote branches using Visual Studio Git?


Recently, I have pushed my code from local git to azure-devops, but after pushing code and clicking on "Fetch" doesn't update my local branches, it should have two branches dev & master but showing only one.

So, How can I update branches locally to show dev and master in my Visual Studio 2017 Git?


Asked by:- jaya
1
: 6272 At:- 10/12/2018 8:35:31 AM
Visual-studio Visual-studio-2017 git-branches-not-updated-in-visual-studio







2 Answers
profileImage Answered by:- neena

You may have to save settings in your Visual Studio "Team Explorer" to always prune on fetch (then fetch branches again from a remote server), to do that follow these steps:

  1. Click on "Team Explorer" Window in your Visual Studio
  2. Then Click on "settings"
  3. Now from the Menu Options Select "Global Settings"
  4. In the Global settings window, Set "Prune remote branches during fetch" to "True"
  5. Click "Update".
    visual-studio-not-pulling-all-remote-branches-min.png
  6. Once you have followed the above steps, open solution in Visual Studio, click "Team Explorer"-> Select "Sync"-> Select "Fetch" in synchronization tab.

You should now see updated remote branches now.

OR

In your local repository directory, you should use git fetch -p (or git fetch --prune) command, it will check if the tracking references of branches, exist or not and delete non-existing ones before fetching.

3
At:- 10/17/2018 9:21:00 AM Updated at:- 9/27/2022 7:39:08 AM
Thanks, it worked for me, I wasn't aware about to make "True " to always prune remote branches on fetch options. 0
By : jaya - at :- 10/22/2018 2:50:33 PM


profileImage Answered by:- vikas_jk

Open Team Explorer in Visual Studio, select the branch which you want to update and then click on "Fetch".

OR

If you don't have remote branch selected or locally, checked out, Find the remote branch in remotes -> origin, then double-click that branch to get it selected locally. Now you can fetch/sync/etc.

0
At:- 9/27/2022 7:39:09 AM






Login/Register to answer
Or
Register directly by posting answer/details

Full Name *

Email *




By posting your answer you agree on privacy policy & terms of use