gitsvngit-svn

Update old git repo from Subversion


I started working with gSOAP and found a git version of the source code in Github. But it turned out this repo hasn't been updated for 10 years. Since it's the top entry for "gsoap source code" in Google I wanted to update it, but I have no idea how it was originally created. Is it possible to update it using git svn?


Solution

  • I got some ideas from https://stackoverflow.com/a/38706530/264822 but had to play around with it a few times to get this to work.

    1. Fork the repo in Github.
    2. git clone my copy of the repo from Github.
    3. git checkout -b github to make a copy of master.
    4. git branch -d master to delete master.
    5. Edit .git/config to add the official Subversion URL:
        [svn-remote "master"]
           url = https://svn.code.sf.net/p/gsoap2/code/
           fetch = :refs/heads/master
    
    1. git svn fetch master to migrate the Subversion history into master.
    2. git checkout master
    3. git rebase github to rebase the original Github history onto the Subversion history.
    4. git branch -d github clean up.
    5. git push --set-upstream origin master force push the new history.
    6. Create a PR from my updated repo back to the original Github repo.

    There may be a simpler way of doing this (e.g. pulling the Subversion history into a branch) but this method works.