How to import an existing GIT project into SVN while keeping the GIT history in the main branch?

I have a project developed with GIT and having several hundred commits. I have only one leading branch, and commits are linear.

Now I will be asked to put the source in the existing SVN, and ultimately I want to save the commit history (messages and differences, the author is preconfigured for SVN access).

I like to rewrite the entire commit history in SVN. Is there any way from GIT to make this more or less automatic?

One thought occurred to me, but I don’t know how to approach it: I create a new empty one trunk/in SVN, clone it using GIT (i.e. an empty GIT clone of SVN) and playing my master goes into it, not dcommit .

In the future, I will continue to work with the GIT branch and synchronize it with SVN.

+3
source share
2 answers

Google has a very detailed tutorial on how to do this here . It is intended to be imported into Google code, but will work for any svn repository.

+2
source
  • Set up an empty SVN project with some fixation.
  • "git svn clone" it.
  • Import history into this nearly empty git-svn project (rebase here)
  • "git svn dcommit".

Questions:

  • Timestamps are broken, author names are violated.
  • "git svn dcommit" does not work as well when there are too many commits for dcommit. Packing of 20 commits is preferred.
0

Source: https://habr.com/ru/post/1755328/


All Articles