有人推了一个分行testgit push origin test共享仓库的共享仓库。git branch -r如何查看遥控器test我试过了

  • git checkout test,它没有做任何事情
  • git checkout origin/test给给* (no branch)

当前回答

你可以试试

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 checkout -b branch-name origin/branch-name

它在抛出错误:

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

我必须这样做:

git checkout -b branch-name commit-sha

命令

git fetch --all
git checkout -b <ur_new_local_branch_name> origin/<Remote_Branch_Name>

等于

 git fetch --all

时和时

 git checkout -b fixes_for_dev origin/development

两者将创造latest fixes_for_dev调自development

在我看来,没有人建议 最简单的方法(也许我太笨了 觉得这太蠢了)"一种方式"但无论如何,试试这个:

git pull origin remoteBranchName
git switch remoteBranchName

这对我也有效(在我最后一次拉拉请求后,在遥控器上创建了一个分支)。

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

git fetch origin 'remote_branch':'local_branch_name'

这将获取远程分支, 并创建一个新本地分支( 如果尚未存在) 名称local_branch_name并追踪其中的遥控者。

从远程获取并检查分支。

git fetch <remote_name> && git checkout <branch_name> 

例如:

git 获取来源 git 检出功能/ XYZ-1234- Add- 警告