Git checkout: updating paths is incompatible with switching branches

后端 未结 11 836
你的背包
你的背包 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:14

    Not sure if this is helpful or exactly relevant to your question, but if you are trying to fetch and checkout only a single branch from the remote repository, then the following git commands will do the trick:

    url= << URL TO REPOSITORY >>
    branch= << BRANCH NAME >>
    
    git init
    git remote add origin $url
    git fetch origin $branch:origin/$branch
    git checkout -b $branch --track origin/$branch
    

提交回复
热议问题