有人可以进一步解释用git检查远程分支吗?

Jam*_*mie 7 git

我在几个问题看这里,特别是这一个,但我仍然感到困惑.

我有一个服务器设置有一个慢速上行链接,我通过SSH隧道访问.在它上面,我克隆了一个Linux内核的裸存储库(origin指向kernel.org).然后我克隆了我的家用机器上的裸存储库,签出了标签,创建了一个分支('测试'说),在该分支上进行了更改,最后将更改推送到我服务器上的裸存储库.

现在我在一个客户端站点,想要检查分支机构.为了避免我在客户端站点的缓慢上行链路,我从kernel.org克隆了linux repo并通过SSH隧道将"origin"更改为指向我的服务器. 我可以看到分支,但无法检查出来:

~/linux-3.0.y$ git version
git version 1.7.0.4
~/linux-3.0.y$ 
~/linux-3.0.y$ git status
# On branch master 
nothing to commit (working directory clean)
~/linux-3.0.y$ 
~/linux-3-0.y$ git remote show origin
git-user@localhost's password:
* remote origin
  Fetch URL: git+ssh://git-user@localhost:48884/home/git-user/linux-3.0.y
  Push  URL: git+ssh://git-user@localhost:48884/home/git-user/linux-3.0.y
  HEAD branch: master
  Remote branches:
    test    new (next fetch will store in remotes/origin)
    master  new (next fetch will store in remotes/origin)
  Local ref configured for 'git push':
    master pushes to master (up to date)
~/linux-3.0.y$ 
~/linux-3.0.y$ git checkout -b test origin/test
fatal: git checkout: updating paths is incompatible with switching branches.
Did you intend to checkout 'origin/test' which can not be resolved as commit?
Run Code Online (Sandbox Code Playgroud)

我实际想要的是能够在我家客户网站上创建的分支机构上工作. 我应该怎么做(已经完成)来结账这个分支?

Let*_*_Be 15

首先,似乎你没有取得分支机构.

git branch -a而不是git remote show origin.

如果缺少测试分支,那么就做git fetch --all.

现在,如果要将远程分支签出为具有相同名称的本地分支,只需这样做git checkout BRANCH_NAME,它将自动设置为跟踪原点.