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

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


当前回答

我尝试了上述解决方案,但行不通。试试这个,它奏效了:

git fetch origin 'remote_branch':'local_branch_name'

这将获取远程分支, 并创建一个新的本地分支( 如果尚未存在的话) , 名称为本地_ branch_ name , 并跟踪其中的远程分支 。

其他回答

我尝试了上述解决方案,但行不通。试试这个,它奏效了:

git fetch origin 'remote_branch':'local_branch_name'

这将获取远程分支, 并创建一个新的本地分支( 如果尚未存在的话) , 名称为本地_ branch_ name , 并跟踪其中的远程分支 。

git 远程显示 & lt; 原始名称 & gt; 命令将列出所有分支( 包括未跟踪的分支) 。 然后您可以找到要获取的远程分支名称 。

例如:

git remote show origin

使用这些步骤获取远程分支 :

git fetch <origin name> <remote branch name>:<local branch name>
git checkout <local branch name > (local branch name should the name that you given fetching)

例如:

git fetch origin test:test
git checkout test

似乎没有人提出最简单的方法(也许我太笨了,

git pull origin remoteBranchName
git switch remoteBranchName

同一个案例(在我最后一次拉拉请求后,在遥控器上创建了一个分支)为我工作。

因为某种原因,我不能做:

git checkout -b branch-name origin/branch-name

它扔出错误:

致命 : “ 来源/ 分支名称” 不是一个承诺, 无法从中创建分支“ 分支名称 ” 。

我不得不这样做:

git checkout -b branch-name commit-sha

对我们来说, 远程的. 起源. fetch 配置有问题。 因此, 我们看不到任何其他的远程分支, 以至于我们看不到主人, 所以git getting[-- all] 毫无帮助。 无论是 Git 检查我的分机还是 git check out - b mybranch -- track- track 起源/ Mybranch 都没有工作, 尽管它确实在遥远的地方。

上一个配置只允许获取主机 :

$ git config --list | grep fetch
remote.origin.fetch=+refs/heads/master:refs/remotes/origin/master

使用 * 来修正它,并从源头获取新信息 :

$ git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'

$ git fetch
...
 * [new branch] ...
...

现在我们可以去本地的远程分支检查了

我完全不知道这个配置 怎么会出现在我们本地的仓库里