开发者

Git/SVN interop (preserving histories for both repositories)

开发者 https://www.devze.com 2023-02-17 22:02 出处:网络
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.

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 repos开发者_C百科itory 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.


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

0

精彩评论

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