Using git branch --set-upstream resulted in this message:
The --set-upstream flag is deprecated and will be removed. Consider
using --track or --set-upstream-to
Without thinking about it too much and assuming verb-object order, I then tried
git branch --track remotes/origin/X
This resulted in
Branch remotes/origin/X set up to track local branch X
Argh, not what I wanted. The remote was supposed to be tracked, not do the tracking. How can I undo this and set the remote branch not to track anything.
Technically you don't have to do anything at all: you've created a new local branch named remotes/origin/X
, which is terribly confusing but not actually forbidden (it probably should be rejected), and that local branch tracks local branch X
.
(If you have color turned on, you can see this in git branch -a
output: remotes/origin/X
will be in black while actual remote branches will be in red.)
The simplest thing to do at this point, though, is just to delete that confusingly-named local branch:
$ git branch -d remotes/origin/X
Even if you have both a local branch named remotes/origin/X
and a (really, actually) remote remotes/origin/X
(so that both show up in the git branch -a
output), the above just deletes the local one. Again, the in-various-colors output from git branch -a
can be reassuring here (though I can't reproduce it in SO text).