Somebody pushed a branch called test
with git push origin test
to a shared repository. I can see the branch with git branch -r
.
If the remote branch name begins with special characteres you need to use single quotes around it in the checkout command, or else git won't know which branch you are talking about.
For example, I tried to checkout a remote branch named as #9773
but the command didn't work properly, as shown in the picture below:
For some reason I wondered if the sharp symbol (#) could have something to do with it, and then I tried surrounding the branch name with single quotes, like '#9773'
rathen than just #9773
, and fortunately it worked fine.
$ git checkout -b '#9773' origin/'#9773'