git: tracking upstream



~1 min read


147 words

One of the ways I attempted to fix my problem when my upstream repo was rejecting my pushed changes was to reset my remote. This was a suggested answer in Stack Overflow and I’d seemingly already exhausted my other options.

% git remote -v

origin (fetch)
 origin (push)

% git remote rm origin
% git remote add origin origin

Alas, it didn’t fix the problem, but it did sever the connection I’d previously had in terms of tracking all of those branches that were upstream. There are several different solutions suggested for reestablishing those links in the comments of the answer.

You can track a single branch at a time:

% git branch --set-upstream-to=origin/<branch> <local_branch>

Or, you can track all of the branches at once with:

% git remote update

Fortunately, I’m now up and running again! Onwards.

Hi there and thanks for reading! My name's Stephen. I live in Chicago with my wife, Kate, and dog, Finn. Want more? See about and get in touch!