Here's the situation:
$ git branch --all -vv
* feature/crvc11-93-add-pec 93fe8bc ...
release/19.3.0-cv011 4012d42 [origin/release/19.3.0-cv011] ...
remotes/origin/feature/crvc11-93-add-pec 93fe8bc ...
remotes/origin/release/19.3.0-cv011 4012d42 ...
I don't know why feature/crvc11-93-add-pec
did not track the remote-tracking branch origin/feature/crvc11-93-add-pec
when I checked it out, but now I want to add it as the upstream manually:
$ git branch --set-upstream-to origin/feature/crvc11-93-add-pec
fatal: Cannot setup tracking information; starting point 'origin/feature/crvc11-93-add-pec' is not a branch.
What does Git mean here? Yes, it is a branch, it's the remote-tracking branch. If I remove the origin
prefix then we get
$ git branch --set-upstream-to feature/crvc11-93-add-pec
warning: Not setting branch feature/crvc11-93-add-pec as its own upstream.
How do I make feature/crvc11-93-add-pec
track origin/feature/crvc11-93-add-pec
? They are the same commit, this should just work. Am I not "spelling" the branch name correctly? Inserting the =
doesn't seem to make any difference.
MORE INFO I suspect the issue has something to do with this being a shallow depth-1 one-branch clone (release/19.3.0-cv011
). I think there are special rules about fetching and remote-tracking branches when you do that. .git/config contains this line:
fetch = +refs/heads/release/19.3.0-cv011:refs/remotes/origin/release/19.3.0-cv011
...and I have a feeling that that changes the whole game in some way. If so, it's unfortunate, as I really don't want the entire history occupying space on my computer.