Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Changing the tracked Git branch in Visual Studio

I setup a specific branch for 2 developers to code on.

Visually in visual studio it appears they are connected to the same branch

But I have discovered that they are infact working on separate branches

The branch tooltip shows that the tracked branch are different between the 2 of them, even though they are connected to the same branch name

This screenshot shows the sprint3 branch (by name) is tracked to the sprint3 branch

https://i.sstatic.net/H0oZa.jpg

This screenshot shows the sprint3 branch (by name) is tracked to the master branch

https://i.sstatic.net/NbGZB.jpg

How would I update the 2nd screenshot to point to the correct branch, so that all the code changes are together in a single branch?

Solved: I was able to fix the issue by opening the git config file and changing the branch merge pointer to the correct location

like image 664
mrb398 Avatar asked Jan 23 '26 23:01

mrb398


2 Answers

I was able to fix the issue by opening the git config file and changing the branch merge pointer to the correct location

like image 139
mrb398 Avatar answered Jan 26 '26 15:01

mrb398


That's not how Git works. Once people clone the repo, they can do whatever they want within the repo. It's only when they attempt to push changes that you can control whether they're permitted to do so, or not.

It looks like two people cloned the repo, and one person created a local branch called "sprint3" pointing to the "sprint3" remote branch. In another case, they created a local branch called "sprint3" pointing to the "master" remote branch.

Assuming they haven't pushed changes yet, the person who has a local "sprint3" branch pointing to "master" on the remote can update their tracked branch:

git branch branch_name --set-upstream-to <remote>/<CorrectBranch>

like image 21
Daniel Mann Avatar answered Jan 26 '26 15:01

Daniel Mann