Michael
Michael

Reputation: 169

Git/SVN interop (preserving histories for both repositories)

I'm developing a software module for an application, owned by a customer with SVN-based development process. Up to now, I have been used my own Git repository in doing so.

Now, the module is mature enough to become part of the clients SVN tree. I did some git-svn based work in the past, but never with two initially independent repositories (the git part was always a clone taken from SVN).

Is it possible to 'inject' a standalone git repository into a Subversion repository and let also his history become part of the SVN's repo? After that 'normal' work with git-svn on top of SVN should follow.

Upvotes: 3

Views: 277

Answers (1)

dahlbyk
dahlbyk

Reputation: 77620

I would suggest the following:

  1. git svn clone the Subversion repository

  2. Add your existing git repository as a remote (let's call it mod) in the git-svn repo

  3. Fetch your module work into the git-svn repo and checkout into a new branch:

    git fetch mod && git checkout mod/master -b mod-svn

  4. Rebase that branch against the latest from subversion with git svn rebase. At this point you should have a linear history with everything from Subversion followed by all your module work.

  5. git svn dcommit to save your module work into Subversion

Upvotes: 3

Related Questions