這個問題似乎是由於我對git 1.5的經驗不足而產生的,因爲如果我嘗試使用1.7版本的系統,這種方式工作得很好。爲什麼我最終選擇了「無分支」,更重要的是,我能做些什麼才能到達「interesting_branch」的頭部?爲什麼git checkout「origin/branch-name」在git 1.5中導致「no branch」?
$ git --version
git version 1.5.6.5
git clone [email protected]: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