下面哪一行是正确的?

git checkout 'another_branch'

or

git checkout origin 'another_branch'

or

git checkout origin/'another_branch'

它们之间的区别是什么?


当前回答

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

Git开关branch-name

其他回答

要切换到一个分支与你的改变,你应该先做一个取回。这是为了像您的包一样保存更改。Json或。env文件

所以: git获取

然后: Git checkout <新分支>

这个答案是给那些被困住一段时间的人的,比如我。

日常工作中有用的命令:

git checkout -b "branchname" ->  creates new branch
git branch                   ->  lists all branches
git checkout "branchname"    ->  switches to your branch
git push origin "branchname" ->  Pushes to your branch
git add */filename           -> Stages *(All files) or by given file name
git commit -m "commit message" -> Commits staged files
git push                     -> Pushes to your current branch

如果你想从特性分支合并到开发, 首先使用命令“git branch dev/develop”检查dev分支 然后输入合并命令"git merge featurebranchname"

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

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

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

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

检查远程分支列表:

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开关[branch]或 git结帐[branch]

示例:git switch develop OR Git检查开发