我想創建基於其他分支的本地分支。例如I型:基於另一個分支創建git分支
git checkout -b feature1 release1.1.3
之後,我得到:
fatal: git checkout: updating paths is incompatible with switching branches.
如何處理此問題?
我想創建基於其他分支的本地分支。例如I型:基於另一個分支創建git分支
git checkout -b feature1 release1.1.3
之後,我得到:
fatal: git checkout: updating paths is incompatible with switching branches.
如何處理此問題?
要創建基於另一個分支的分支,最簡單的方法是先檢出基本分支,然後從那裏創建一個新分支。如果我理解你的問題,那正是你想要做的。
現在,當您在分支中使用-b
標誌時,您可能會進行需要保留的工作更改。如果是這樣的話,你應該把它們推到隱藏處,檢查基本分支,創建新分支,並彈出藏匿處。
您的意思是git branch feature1 release1.1.3
假設您想要一個名爲feature1的分支基於release1.1.3提交。你在那裏調用的應該也可以工作,但是你的工作樹中也有一個名爲'release1.1.3'的實際文件夾,git對你是指分支/標籤還是文件夾感到困惑。
你可以嘗試給出release1.1.3的實際提交ID。
先做git pull
首先確保你所有的本地分支都是最新的。然後你可以切割分支。
語法
$ git checkout -b <branch> --track <remote>/<branch>
或
$ git checkout <remote>/<branch> -b <branch>
'git checkout -b
@ FelixKling謝謝你,我只是更新了我的帖子。 – zsong 2013-02-22 15:02:28
git branch <new-branch-name> <existing-branch-name>
確實'release1.1.3'存在嗎?看到這個問題http://stackoverflow.com/questions/945654/git-checkout-on-a-remote-branch-does-not-work。 – 2013-02-22 14:57:23