当我输入时,git branch显示
* master
restaurentaddtofav
我相信我在主分公司。我做了一些改变。我需要切换到 restaurentaddtofav ,所以我可以提交更改。我该怎么做?
当我这样做时,git checkout -b restaurentaddtofav
它说
A branch named 'restaurentaddtofav' already exists.
答案 0 :(得分:2)
请参阅git-checkout(1)
手册页:
git checkout -b|-B <new_branch> [<start point>]
Specifying -b causes a new branch to be created as if git-branch(1) were
called and then checked out. […]
因此,通过显式请求创建新分支,当该分支已存在时,您收到错误消息是正确的。
要结帐现有分支,另请参阅git-checkout(1)
手册页:
git checkout <branch>
To prepare for working on <branch>, switch to it by updating the index and
the files in the working tree, and by pointing HEAD at the branch. […]