我已经使用 git-svn 一段时间了(我团队中的其他人都直接使用 svn)。我们决定我们都开始使用 git。为了做到这一点,我使用了 git repo,它是 git-svn 的“一面”,如下所示:
$ git remote add origin git@github.com:mycompany/myproject.git
$ git push -u origin master
Run Code Online (Sandbox Code Playgroud)
这很顺利,但是当这个过程完成后,我保留了 git-svn 在我第一次开始使用它时创建的所有这些荒谬的分支,有一个小问题;git 甚至不再承认它们是分支。我的清单如下:
$ git branch -r
domain_integration
dot-org
dot-org@1977
email-edit-page
origin/account-integration
origin/master
origin/stable
prototype_to_jquery-1.1.0
stable@1976
tags/development-1.1.0.0
tags/pre-2011-02-08
tags/production-1.0
tags/stable-1.0.0
tags/stable-1.0.1
tags/stable-1.1.0
tags/stable-1.1.0.1
trunk-stash
Run Code Online (Sandbox Code Playgroud)
这些很烦人,虽然我知道它们(大部分)来自哪里,但现在我什至无法删除它们。有时候是这样的:
$ git branch -d trunk-stash
error: branch 'trunk-stash' not found.
Run Code Online (Sandbox Code Playgroud)
我可以通过进入 .git/refs/remotes 并删除它们来修复其中的一些问题,但那里只有几个。我唯一能找到它们的地方是 .git/info/refs。看起来像下面这样:
...
7788d300f0d4370d65a3ccf3e47d90f7fb16b0b4 refs/remotes/tags/stable-1.0.0
aace34d6745080ce2b6b29e927f5d1b050b99511 refs/remotes/tags/stable-1.0.1
58bd2ac23d5979ff61bd6305df18f8a5da50f888 refs/remotes/tags/stable-1.1.0
644fd55fcdf2569305cdbe0b6fefb9f247625658 refs/remotes/tags/stable-1.1.0.1
bc8e9f9177c9612aceb55624adea1b02e9e8620f refs/remotes/trunk
69493e14345e6a7a4db324935bccd6393f201da4 refs/remotes/trunk-stash
25b7024f6c1d38c10400b2c2e7b446aae1e84e06 refs/stash
...
Run Code Online (Sandbox Code Playgroud)
我认为这只是将分支与其上次提交相关联。删除“假”的有意义吗?这会破坏什么东西吗?(会起作用吗?)