有人将称为 Git 推力源测试的分支推向共享仓库 。 我可以看到有 git 分支 -r 的分支 。 我如何查看远程测试分支 ? 我试过 :

git 检出测试, 它不会给 git 检出源/ 测试提供任何结果 * (无分支)


当前回答

简单的 Git 检查退出时使用远程分支的名称。 git 会自动创建本地分支, 跟踪远程分支 :

git fetch
git checkout test

但是,如果在不止一个远程中发现该分支名称, 这不会起到Git不知道该使用什么的作用。 在这种情况下, 您也可以使用 :

git checkout --track origin/test

git checkout -b test origin/test

在 2.19 中, git 学会了检出。 默认远程配置, 指定了在解决这种模糊性时的远程默认值 。

其他回答

有许多替代办法,例如:

替代 1: git 抓取 git 检出测试, 这是最简单的方法 。 替代 2: git 抓取 git 检出测试相同, 但分为两步 。

您可以尝试

git fetch remote
git checkout --track -b local_branch_name origin/branch_name

git fetch
git checkout -b local_branch_name origin/branch_name

工作命令

git 获取源“ remote_ branch ” : “ 本地_ branch_ name” git开关 “ 本地_ branch_ name” git pull 源“ remote_ branch ” : “ 本地_ branch_ name ”

第一个是从远程分支获取分支和创建本地分支。

第二个是转换到当地分行。

第三是将最近的远程更改拖到本地分支。

在您的情况中,您可以使用此命令:

git 检出 -b 测试来源/测试

运行这两个命令,你应该可以去。

git checkout <branch-name>
git pull <remote> <branch-name>