【发布时间】:2018-06-07 13:48:29
【问题描述】:
我的远程源上只有 master 分支。
然后我做了:
git fetch origin refs/heads/master:refs/remotes/origin/master2
结果我得到了:
* [new branch] master -> origin/master2
好像没问题。
它显示为带有master的远程跟踪分支:
bash$ git branch -r
origin/HEAD -> origin/master
origin/master
origin/master2
但master2显示为:
bash$ git remote show origin
Remote branches:
master tracked
refs/remotes/origin/master2 stale (use 'git remote prune' to remove)
我。我的第一个问题是为什么 master2 显示为过时?我能够获取它(并将其创建为我的本地远程跟踪之一)并且我希望它将映射到远程源/主服务器?
二。第二个问题是为什么我必须这样做:
bash$ git branch -r -d origin/master2
通过提供完整的参考规范来删除它并在尝试执行此操作时出错:
bash$ git branch -r -d refs/remotes/origin/master2
error: remote-tracking branch 'refs/remotes/origin/master2' not found.
我检查了 git-branch 的 man,发现分支名称没有什么特别之处:
<branchname>
The name of the branch to create or delete. The new branch name
must pass all checks defined by git-check-ref-format(1). Some of
these checks may restrict the characters allowed in a branch name.
【问题讨论】:
标签: git