Search code examples
gitsvnversion-controlgit-svn

How to import Subversion commits into Git upstream repository


Here is my scenario:

  • a upstream Git tag 1.2 has been used as first commit in an empty Subversion repository without git svn. Files have been copied and added into Subversion trunk working copy.

  • in Subversion, a small list of changesets have been committed in /trunk

I now would like to use a Git fork from original upstream (large repository) and import these Subversion changesets into a feature branch created from initial tag 1.2.

There is no branch or tag in Subversion repository I am interested in importing into upstream Git repository.

My first trial with git-svn was not successful because the branch created as no common ancestor with upstream history. How should I import my Subversion changesets to be able to operate merge in Git then ?


Solution

  • I think your take with using git svn is ok here.
    You can either force the merge of unrelated histories with using --allow-unrelated-histories as parameter to the merge command.
    Or you can just use git cherry-pick to reapply your newly imported commits on top of the Git tag.