开发者

How do I import an existing GIT project into SVN, preserving GIT history on master branch?

I've a project developed with GIT and have a few hundred commits. I only have one master branch and the commits are linear.

Now I'm asked to put the source into an existing SVN and ultimately I'd like to preserve the master commit history (the messages and the diffs, author i开发者_C百科s preset by SVN access).

It's like I need to replay the whole commit history into SVN. Is there a way from GIT to do this more or less automatic?

One idea came to my mind, but I've no clue how to approach it: I create a new empty trunk/ in SVN, clone it with GIT (i.e. an empty GIT SVN clone) and replay my master changes into it and than dcommit it.

In the future I'll do further work with my GIT branch and synchronize it with SVN.


Google has a very detailed tutorial on how to do this here. It is for importing to Google code, but will work for any svn repo.


  1. Set up empty SVN project with some commit.
  2. "git svn clone" it.
  3. Import history in that almost-empty git-svn project (rebase here)
  4. "git svn dcommit".

Issues:

  1. timestamps are broken, author names are broken.
  2. "git svn dcommit" works not so good when there are too much commits to dcommit. Splitting to packs of about 20 commits each is preferred.
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜