下面哪一行是正确的?

git checkout 'another_branch'

or

git checkout origin 'another_branch'

or

git checkout origin/'another_branch'

它们之间的区别是什么?


当前回答

如果你想让分支跟踪远程分支,如果你要向分支提交更改和拉取更改等,这是非常重要的,你需要为实际的签出添加一个-t,如下所示: Git checkout -t branchname

其他回答

如果你想让分支跟踪远程分支,如果你要向分支提交更改和拉取更改等,这是非常重要的,你需要为实际的签出添加一个-t,如下所示: Git checkout -t branchname

检查远程分支列表:

git branch -a

切换到其他分支:

git checkout -b <local branch name> <Remote branch name>
Example: git checkout -b Dev_8.4 remotes/gerrit/Dev_8.4

查看本地分支机构列表:

git branch

所有的更新:

git pull

检查:git分支-a

如果你只得到一个分支。然后执行以下步骤。

步骤1:git配置——list 步骤2:git配置——unset remote.origin.fetch 步骤3:git配置——添加remote.origin.fetch +refs/heads/*:refs/remotes/origin/*

切换到git中的另一个分支。直截了当的回答,

git-checkout -切换分支或恢复工作树文件

git fetch origin         <----this will fetch the branch
git checkout branch_name <--- Switching the branch

在切换分支之前,确保您没有任何修改过的文件,在这种情况下,您可以提交更改或保存它。

切换到git中的另一个分支可以用一个命令完成。

Git开关branch-name