tl;dr: git checkout master
does not switch to master branch, gives no error or any output at all and I have no clue why. Any other branch works
I have seen something similar when there is a folder master in the source tree. Unfortunately I didn't find a way to tell git to interpret the value as a branch. Renaming the folder fixed the problem for me.
The local master branch in your repository is not different from any other local branch in your repo. You cloned your repository to your development branch, which is the only local branch you have. Thus, if you try to checkout to your local master branch, git says it does not exist.
If you want to have both development and master local branch initially the same, you can do one of these things:
Download your repo to master branch, and create a local development branch:
git clone <repo_url>
git checkout -b development
or download your repo to development branch, and create a local master branch:
git clone <REPO-URL> --branch development
git checkout -b master
If your repo has a folder or file name the same as a branch name then you will need to: git checkout xyz --
with the extra --
at the end. It tells git to use a branch or commit instead of trying to use a folder/file name.
Found the answer on another stackoverflow post: Git change branch when file of same name is present
The accepted answer (renaming the folder) works. If you don't want to do that, here's a work-around that I tested on git version 2.14.1.windows.1
.
Delete the offending folder.
perform git branch <the branch you had trouble switching to>
perform git branch <your original branch>
perform git checkout -- .
to undo the deletion.
Now you can switch to and from your desired branch without issue, even with a with a folder in the repo that's named the same as a branch. You'll notice that the branch appears in the branch list if you perform git branch