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

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

当前回答

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

git pull origin remoteBranchName
git switch remoteBranchName

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

其他回答

你可以试试

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

git fetch
git checkout -b local_branch_name origin/branch_name

我被困在一个状况中看到error: pathspec 'desired-branch' did not match any file(s) known to git.以上所有建议。我正在讨论Git 1.8.3.1版本。

所以这个为我工作:

git fetch origin desired-branch
git checkout -b desired-branch FETCH_HEAD

背后的解释是,我注意到 当我拿起遥控树枝时,时前:

git fetch origin desired-branch

From github.com:MYTEAM/my-repo
    * branch            desired-branch -> FETCH_HEAD

你基本上看到了树枝,但你还没有本地的拷贝!

你需要,你需要fetch分支...

您可以简单地获取并退出分支, 使用下面的一条线命令来做到这一点 :

git fetch && git checkout test

我还创建了下面的图像 让你分享差异,看看如何fetch以及它是如何与pull:

git fetch

请遵循命令创建空文件夹。 请输入并使用此命令 :

saifurs-Mini:YO-iOS saifurrahman$ git clone your_project_url
Cloning into 'iPhoneV1'...
remote: Counting objects: 34230, done.
remote: Compressing objects: 100% (24028/24028), done.
remote: Total 34230 (delta 22212), reused 15340 (delta 9324)
Receiving objects: 100% (34230/34230), 202.53 MiB | 294.00 KiB/s, done.
Resolving deltas: 100% (22212/22212), done.
Checking connectivity... done.
saifurs-Mini:YO-iOS saifurrahman$ cd iPhoneV1/
saifurs-Mini:iPhoneV1 saifurrahman$ git checkout 1_4_0_content_discovery
Branch 1_4_0_content_discovery set up to track remote branch 1_4_0_content_discovery from origin.
Switched to a new branch '1_4_0_content_discovery'

git fetch --all

将所有远程分支都带回您的本地

git checkout test

将您切换到测试分支