为什么 git-svn clone 设置“master”?到随机分支?
我正在尝试将现有的 svn 存储库移至 git。我们不需要在两者之间进行任何同步(因此没有 git svn fetch
es 或 dcommit
s)——我们只是移过去,仅此而已。
我发出这个命令来创建 git 存储库:
git svn clone -s https://server/repos/my_repo
这运行得很好。但是,当我cd
进入新的my_repo
目录时,其中的文件是其中一个分支(而不是主干)的一部分。
执行 git Branch -a 会产生:
* master
modelExperimentalTrunk
modelExperimentalTrunk@719
dRefactoring
reorganise
stableV396
tags/v1.0
trunk
我位于 master 分支,但沙箱中的文件实际上来自 dRefactoring 分支(我们比较模糊的分支之一) )。
问题:
- 为什么
master
分支没有连接到trunk
? - 有没有办法将其重新连接到
trunk
?或者可以在 git svn clone 阶段完成吗? - 另外,考虑到这将在服务器上,有什么方法 git svn 可以创建 --bare 存储库吗?
I'm trying to move our existing svn repository to git. We don't need to do any syncing between the two (so no git svn fetch
es or dcommit
s) -- we're just moving over and that's it.
I issued this command to create the git repository:
git svn clone -s https://server/repos/my_repo
This ran fine. However, when I cd
'd into the new my_repo
directory, the files that were in there were part of one of the branches (not the trunk).
Doing a git branches -a
yields:
* master
modelExperimentalTrunk
modelExperimentalTrunk@719
dRefactoring
reorganise
stableV396
tags/v1.0
trunk
I am on the master branch, but the files that are in my sandbox are actually from the dRefactoring
branch (one of our more obscure branches).
Questions:
- Why was the
master
branch not connected totrunk
? - Is there a way to reconnect it to
trunk
? Or can that be done during thegit svn clone
stage? - Also, given that this is going to be on a server, is there any way
git svn
can create a --bare repository?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
将主分支重新连接到主干很容易,只需运行:
这会切换到主分支(如果还不是这种情况)并将其和工作树重置为主干分支的状态。之后您可以安全地删除主干分支。
git-svn 不支持开箱即用的裸存储库。请阅读 http://gsocblog.jsharpe.net/archives/12 了解更多详细信息。但我认为您不需要这个复杂的解决方案,因为您只想对 SVN 存储库进行一次导入。
因此,您只需创建现有 git 存储库的裸克隆即可。
Reconnecting the master branch to trunk is easy, just run:
This switches to master branch (if this is not already the case) and resets it and the working tree to state of the trunk branch. After this you can safely delete the trunk branch.
git-svn doesn't support bare repositories out of the box. Read http://gsocblog.jsharpe.net/archives/12 for more details. But I don't think that you need this complicated solution as you just want to do a single import of your SVN repository.
Therefore you can just create a bare clone of your already existing git repository and you're set.