Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Git/SVN interop (preserving histories for both repositories)

Tags:

git

git-svn

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.

like image 666
Michael Avatar asked Nov 29 '25 22:11

Michael


1 Answers

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

like image 170
dahlbyk Avatar answered Dec 01 '25 11:12

dahlbyk



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!