Branch names beginning with '#' can't seem to be fetched correctly

In order to checkout a forked branch to review locally, I attempted to use the "Check out branch" instructions. However, I always get the master branch of the fork, not the requested branch.

Step 1. Fetch and check out the branch for this merge request

git fetch git@gitlab.com:rpadovani/gitlab-ce.git #30974-issue-search-by-number
git checkout -b rpadovani/gitlab-ce-#30974-issue-search-by-number FETCH_HEAD

It seems that if the branch has a # in it, it will not get fetched correctly. Recreating it on a personal repository,

git fetch git@gitlab.com:digitalmoksha/bug-reproduction.git #branch-name-with-hash

gives * branch HEAD -> FETCH_HEAD while

git fetch git@gitlab.com:digitalmoksha/bug-reproduction.git branch-name-no-hash

gives * branch branch-name-no-hash -> FETCH_HEAD

I ran into this problem with this MR: https://gitlab.com/gitlab-org/gitlab-ce/merge_requests/28302 where the forked branch name begins with a #

Edited Dec 07, 2020 by 🤖 GitLab Bot 🤖
Assignee Loading
Time tracking Loading