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

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

当前回答

缩略git remote show <origin name>命令将列出所有分支(包括未跟踪的分支)。然后您可以找到要获取的远程分支名称。

示例:

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

它在抛出错误:

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

我必须这样做:

git checkout -b branch-name commit-sha

从远程获取并检查分支。

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

例如:

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

命令

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

工作命令

  1. git fetch origin 'remote_branch':'local_branch_name'

  2. git switch 'local_branch_name'

  3. git pull origin 'remote_branch':'local_branch_name'

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

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

第三是将最近的远距离变化推到当地分部。

这些答案对我毫无用处。

git checkout -b feature/branch remotes/origin/feature/branch