远程分支的git-checkout不一致

时间:2017-08-02 11:05:40

标签: git

已在this thread 中找到解决方案:分支名称与存储库中的文件夹名称相同。

我查看了一个不同分支的git仓库

$ git clone <repo> .
$ git branch -a
* b1
  remotes/origin/HEAD -> origin/b1
  remotes/origin/b1
  remotes/origin/b2
  remotes/origin/b3

没有主分支,默认为b1

$ cat .git/config
...
[branch "b1"]
  remote = origin
  merge = refs/heads/b1

我正在使用git版本1.9.1。 根据{{​​3}},我只需要git checkout b2结帐并使用本地分支origin/b2跟踪远程分支b2

$ git checkout b2
  Branch b2 set up to track remote branch b2 from origin.
  Switched to a new branch 'b2'

分支已添加到.git/config

但如果我试图结帐另一个分支......

$ git checkout b3

......没有任何反应。没有错误消息,也没有结帐到分支b3

我能做到

$ git checkout -b b3 origin/b3
Branch b3 set up to track remote branch b3 from origin.
Switched to a new branch 'b3'

两个分支之间可能有什么区别,以便checkout表现不同?

是否可以使用哪个git版本创建/提交/推送分支?

更新

此帖子中使用的分支名称是真正的分支名称(我希望避免在此处显示)。

结帐不存在的分支显示:

$ git checkout invalid_branch
error: pathspec 'invalid_branch' did not match any file(s) known to git.

0 个答案:

没有答案
相关问题