Share via


Git local master branch not tracking remote master

Question

Saturday, August 3, 2019 3:05 AM

Hello,

I'm using VS 2019 v16.2.0.

I set up a git repository on GitHub and connected it to my version of VS at work.  Everything's working great there.  However, I cloned my repository to my computer at home and was able to get the repository.  I think I made a branch and pushed some changes to that branch from home.  I then incorporated those changes to my VS at work and made more changes on a new branch at work and pushed those changes to the master branch at work.

OK. So work VS is fine.  Now, I Sync'ed my local repo at home and got the new branch that was created at work, but did not get the master sync'ed.  When I have master checked out and go to the Sync section, it is complaining that I don't have master set to a remote branch.  It says, "Current branch does not track a remote branch".  And there isn't a little green arrow on the icon next to my local master branch in the Branches section.  All my other branches are tracking a remote branch except my local master branch.

I'm not sure how I got to this state.  I tried searching for this problem with no luck.  How can I set my local master to track the remote master branch?

I'd appreciate any info you can give about this...steve--

All replies (2)

Sunday, August 4, 2019 12:37 PM ✅Answered

You can probably use this command line to get your branch to track remote repository

git branch -u upstream/main

https://stackoverflow.com/questions/520650/make-an-existing-git-branch-track-a-remote-branch


Monday, August 5, 2019 2:58 AM

Hi s-orton9999,

Welcome to the MSDN forum.

Please have a try with the command that Ken recommended, if not works, please feel free to let us know.

Usually, we can use ‘git branch -a’ to show your remote and local branches and then set the local branch to track a remote branch as below:

Meanwhile, for the better professional support about Git, we can also redirect to this appropriate forum with ‘git’ tag, since our forum is to discuss the VS IDE, thanks for your understanding.

Best regards,

Sara

MSDN Community Support Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact [email protected]