为什么git checkout"origin/branch-name"导致git 1.5中的"no branch"?

Let*_*ion 2 git

这个问题似乎源于我缺乏git 1.5的经验,因为如果我尝试使用1.7的系统,这个工作正常.为什么我最终选择"没有分支",更重要的是,我能做些什么来获得"interesting_branch"的HEAD?

$ git --version
git version 1.5.6.5
git clone git@git.example.com:path/to/repo
Initialized empty Git repository in some/local/path/.git
<snip>
cd path
git branch -a
* master
  origin/HEAD
  origin/develop
  origin/feature-cg-interesting_branch
$ git checkout feature-cg-interesting_branch
error: pathspec 'feature-cg-interesting_branch' did not match any file(s) known to git.
$ git checkout -- feature-cg-interesting_branch
error: pathspec 'feature-cg-interesting_branch' did not match any file(s) known to git.
$ git checkout origin/feature-cg-interesting_branch
Note: moving to "origin/feature-cg-interesting_branch" which isn't a local branch
If you want to create a new branch from this checkout, you may do so
(now or later) by using -b with the checkout command again. Example:
  git checkout -b <new_branch_name>
HEAD is now at 6534d1d... [Commit message]
$ git branch 
  * (no branch)
  master
Run Code Online (Sandbox Code Playgroud)

DrT*_*rsa 5

您需要手动创建本地跟踪分支:

$ git checkout -b feature-cg-interesting_branch origin/feature-cg-interesting_branch
Run Code Online (Sandbox Code Playgroud)

您应该为每个remore分支执行此操作,除了 master