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?
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:
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.
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.
Subscribe to our weekly Newsletter & Keep getting latest article/questions in your inbox weekly