简体   繁体   English

如何在保持历史记录的同时将git repo推送到现有的SVN repo?

[英]How to push a git repo to an existing SVN repo while maintaining history?

I have a git repo of a project that was started before an official SVN repo had been established. 我有一个在正式的SVN存储库建立之前就开始的项目的git存储库。 The git repo has a directory structure of something like: git repo具有如下目录结构:

docs/
src/
  herp/
  derp/

I want to push this into the existing SVN repo (in which others are working), so that the directory structure in SVN would look something like: 我想将其推送到现有的SVN存储库中(其他人正在使用该存储库),以便SVN中的目录结构如下所示:

branches/
tags/
trunk/
  ... (other stuff) ...
  fizzbot/
    docs/
    src/
      herp/
      derp/

(since fizzbot is essentially a separate sub-project) (因为fizzbot本质上是一个单独的子项目)

  1. I imagine this would be doable using git-svn, but I don't know exactly how. 我想象使用git-svn这是可行的,但是我不知道怎么做。
  2. If I can do #1, is there a way to do it while preserving the history of all the revisions I made in the git repo? 如果我可以做#1,有什么办法可以保留我在git repo中所做的所有修订的历史呢?

Thanks in advance. 提前致谢。

I think the idea is that you need to: 我认为您需要:

  1. rebase/cherry pick all of the relevant commits on top of the git-svn (a svn repo checked out via git-svn) head, but the bigger problem is that you are effectively trying to rebase / cherry在git-svn(通过git-svn签出的svn repo)头上选择所有相关的提交,但是更大的问题是您正在有效地尝试

  2. merge two separate repos , that can be a little harder to get right. 合并两个单独的存储库 ,可能很难正确处理。 Although I have operated between git-svn repo and git repo that are related (ie the git repo is cloned from the git-svn repo), I have never attempted to merge a git-svn repo with an unrelated git repo this way, but in theory it should be possible provided you can resolve whatever merge conflicts that are likely to occur. 尽管我在相关的git-svn repo和git repo之间进行过操作(即git repo是从git-svn repo中克隆的),但我从未尝试过将git-svn repo与不相关的git repo合并,但是从理论上讲,应该有可能,只要您可以解决可能发生的任何合并冲突。 The good thing is that once you can achieve -1- you are pretty much home-free and no real damage can happen until you do the dcommit (and even so there's the option of dry-run) 好消息是,一旦您实现-1-,您几乎无家可归,除非您进行dcommit,否则就不会发生真正的损害(即使如此,也可以选择空运)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM