Search code examples
gitsvngit-svnportingdcommit

How to clone svn repo with git svn and be able to commit to both git and svn?


I have the following scenario:

I am porting a big repo from which some catalogs I would like to separate into git repositories with independent/separate history, e.g.:

git svn clone  --trunk=https://svne1.XXX.XXX.com/XXXX/svnroot/trunk/ https://svne1.XXX.XXX.com/XXXX/svnroot/trunk/src/project1 --username myname --no-metadata -A ~/Documents/users.txt

This will create a git repository with extracted source code from src/project1 under the trunk and with separate history and I will be able to push it anywhere I desire.

But I need (for some time) to be able to push to svn repo as well and taking into account that I have downloaded only the history of one directory from my project and not the trunk it is not so trivial to allow:

git svn rebase
git svn dcommit

How can I do this then? Having extracted multiple repos from svn to git and commit to both git and svn (having in mind that history in those smaller git repos are different (subset) of history in svn)

EDIT:

After launching running the clone operation and then git svn rebase I would get:

git svn rebase
Unable to determine upstream SVN information from working tree history

Solution

  • You should not use --no-metadata if plan staying in sync:

    svn.noMetadata, svn-remote..noMetadata

           This gets rid of the git-svn-id: lines at the end of every commit.
    
           This option can only be used for one-shot imports as git svn will
           not be able to fetch again without metadata.
    

    I don't think you also need to specify --trunk unless you want to use branches, and if so - would expect trunk to be below the main url, not above.