I am using Git to push several branches into one already existing (including the branches) remote repo on my company's GitLab. The branches in the remote only contain a README.md. All branches have not been versioned with Git yet which is why I use the following commands to push them to their remote locations:
Git Version: 2.31.1.windows.1 (git bash)
cd branchx
git init -b branchx
git remote add origin git@my.company.com:project-group/repo.git
# this is the problematic line:
git branch --set-upstream-to=origin/branchx
git pull --allow-unrelated-histories (to pull the README.md)
git add .
git commit -m "Initial commit"
git push -u origin branchx
This worked like a charm for my first branch. However, when I try to set the upstream branch for another branch (in another folder, where x in branchx is a number) with
git branch --set-upstream-to=origin/branchx
I get the error
fatal: branch 'branchx' does not exist
However, if I type in git branch --set-upstream-to=origin/ and double-tab, I can see the exact origin/branchx I am trying to set as upstream there.
Does anyone have an idea of what might be causing this?