开发者

Suddenly can't create local/remote git branches

Not sure how I've managed this but I can't create a local and remote branch anymore.

~/myapp(master) > git checkout -b new_feature origin/new_feature
fatal: git checkout: updating paths is incompatible with switching branch开发者_Go百科es.
Did you intend to checkout 'origin/new_feature' which can not be resolved as commit?

I've tried re-cloning my app in case the .git directory was corrupted, but no luck. Any suggestions?


You can't create a remote branch that way, you need to first do git checkout -b new_feature to create the new local branch and then git push origin new_feature to push the branch to the remote.


Try one of these:

  • To create a local branch: git branch some_branch

  • To use (checkout) that branch (this is not automatic): git checkout some_branch

  • To create a remote branch: git push origin origin:refs/heads/some_branch

  • To checkout (and track) a remote branch (creating a local_branch if it does not exist yet): git branch --track local_branch origin/remote_branch

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜