我已经开始使用 git 跟踪一个 svn 存储库,方法是只克隆它的主干目录。现在我想跟踪其他东西,但我不想为了使用 --stdlayout
再次克隆它,因为下载需要很长时间,而且我已经有了大部分代码本地。如何更改存储库布局以匹配 svn trunk/branches/tags 方案而无需再次克隆?
最佳答案
旧.git/config
:
[svn-remote "svn"] url = svn://host/project/trunk fetch = :refs/remotes/git-svn
新.git/config
:
[svn-remote "svn"] url = svn://host/project fetch = trunk:refs/remotes/git-svn branches = branches/*:refs/remotes/* tags = tags/*:refs/remotes/tags/*
现在运行 git svn reset -r1 -p; git svn 获取; git svn rebase
.
不,这与重新执行 git svn clone
没什么不同——添加分支意味着 git
可以看到更多 merge ,这意味着内容 git
跟踪已更改,因此 git-svn
必须重新生成所有内容。
关于svn - 在仅跟踪主干的 git-svn 仓库上开始跟踪分支/标签,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1582392/