Someone else on my team created a new git branch, committed and pushed to the usual remote that we work with. When I try to check out this branch, I get this:
% git checkout 12382
fatal: Cannot switch branch to a non-commit '12382'
I have not had trouble checking out other branches from this repository; tried checking another one out right after this (one that I did not have a local copy of), and it worked fine.
I tried building a server with this branch on our Go pipeline, it worked fine - which means the server was successful in checking out that branch.
Tried this to check the status of things:
% git remote show origin
* remote origin
Fetch URL: [email protected]:mycompany/myrepository.git
Push URL: [email protected]:mycompany/myrepository.git
HEAD branch: stage
Remote branches:
10112 tracked
10198 tracked
10678 tracked
...
12382 tracked <<<---
...
Local branches configured for 'git pull':
...
Local refs configured for 'git push':
...
Could anyone suggest how to fix this? What went wrong?
Git is confused, because 12382
looks like a commit hash. Use the fully qualified name to checkout the branch:
git checkout refs/heads/12382 --
or, if it's a remote branch:
git checkout refs/remotes/origin/12382 --