当我输入时,它会显示 git 分支
* master
restaurentaddtofav
我相信我在主分支。我做了一些改变。我需要切换到 restaurentaddtofav ,这样我就可以提交更改。我该怎么做?
当我这样做时,git checkout -brestaurentaddtofav
它说
A branch named 'restaurentaddtofav' already exists.
最佳答案
请参阅 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. […]
因此,通过明确请求创建新分支,当该分支已存在时,您收到错误消息是正确的。
要 checkout 现有分支,另请参阅 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. […]
关于git - 更改为已存在的 Git 分支,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50848002/