我剛剛創建從以前的一個分支指令提交GIT:創建並從以前獲得科提交
git branch thenewbranch 03771674c482e4611cc48ee120a16a91dfb2793d
現在我想簽出分支在Eclipse中使用
$ git checkout -b thenewbranch
但我得到這個錯誤
fatal: A branch named 'thenewbranch' already exists.
我剛剛創建從以前的一個分支指令提交GIT:創建並從以前獲得科提交
git branch thenewbranch 03771674c482e4611cc48ee120a16a91dfb2793d
現在我想簽出分支在Eclipse中使用
$ git checkout -b thenewbranch
但我得到這個錯誤
fatal: A branch named 'thenewbranch' already exists.
git checkout -b thenewbranch
種方式創建一個名爲 「thenewbranch」 新的分支,然後進入它
你只需要
git checkout thenewbranch
git的結帳-B | -B []指定-b導致 新分支被創建好像調用git-branch [1],然後檢出 。在這種情況下,您可以使用--track或--no-track 選項,這些選項將傳遞給git分支。爲方便起見,--track 不帶-b表示分支創建;請參閱下面的--track 的描述。
如果給出-B,則創建它,如果它不存在; 否則,它被重置。這是
事務等同於指定-b
你不需要。 簡單:
git branch thenewbranch 03771674c4
git checkout thenewbranch
的-b
的選擇是不同的行爲,這意味着你實際上要創建一個新的分支稱爲thenewbranch
從您目前的HEAD
(隱含的)。