Git checkout: updating paths is incompatible with switching branches

后端 未结 11 883
你的背包
你的背包 2020-11-27 08:48

My problem is related to Fatal Git error when switching branch.

I try to fetch a remote branch with the command

git checkout -b local-name origin/rem         


        
11条回答
  •  星月不相逢
    2020-11-27 09:36

    I believe this occurs when you are trying to checkout a remote branch that your local git repo is not aware of yet. Try:

    git remote show origin
    

    If the remote branch you want to checkout is under "New remote branches" and not "Tracked remote branches" then you need to fetch them first:

    git remote update
    git fetch
    

    Now it should work:

    git checkout -b local-name origin/remote-name
    

提交回复
热议问题