这些句子中哪一个是正确的?
git checkout 'another_branch'
或者git checkout origin 'another_branch'
或者git checkout origin/'another_branch'
他们之间有什么区别?
这些句子中哪一个是正确的?
git checkout 'another_branch'
或者git checkout origin 'another_branch'
或者git checkout origin/'another_branch'
他们之间有什么区别?
我正在使用这个命令切换不同的分支,你也可以使用它,非常方便。
git switch [分支名] 或者 git checkout [分支名]
例如: git switch develop 或者
git checkout develop
git branch -a
切换到另一个分支:
git checkout -b <local branch name> <Remote branch name>
Example: git checkout -b Dev_8.4 remotes/gerrit/Dev_8.4
Check local Branch list:
git branch
更新所有内容:
git pull
以下是我遵循的步骤:
您可以使用以下命令检查状态和所在分支:
注意:如果您在移动到新分支之前在本地 repo 中进行更改,则以下步骤仍应有效。
如果 "git branch" 显示 master,并且您想要创建并移动到另一个分支:
再次使用 "git branch" 检查分支,现在应该显示您在新分支中。
现在添加、提交和推送:
以上步骤对于我来说都适用,无论是在移动到新的本地分支之前还是之后进行更改。 希望能帮助遇到类似情况的人,并且这也是解决此问题的方法: 链接
git checkout [branch]
这个命令对于大多数使用者来说可能比较常见。 - JGallardogit switch branch-name
,这是一种新的方法。再次强调,git checkout branch-name
仍然被支持并且可用。 - Meet Bhalodiya