git checkout master does not switch branch - repository broken?

前端 未结 4 486
太阳男子
太阳男子 2021-01-07 18:43

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

4条回答
  •  忘掉有多难
    2021-01-07 19:27

    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

    perform git 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

提交回复
热议问题