Search code examples
gitsvngit-svnrevision-history

How to retain git authorship and commit date when using git-svn to push to a subversion repo?


We begin with a new, empty subversion repository and an existing git repository that I would like to 'push' to and retain all history and authorship (even just the username if possible).

Using "git svn dcommit" I'm able to see revision comments in subversion repo's history but the author detail defaults to my username in subversion and the commit date becomes todays date, the date of the push rather than the initial commit in git.

Is there are method to override these properties of interest much like BZR->SVN, with the bazaar.conf override and modification to the pre-revprop-change hook, but this time for Git?

Thanks.


Solution

  • You can't retain author and dates with git-svn (as well as you can't also retain ignores, anonymous branches and complex history using it).

    In order to convert Git repository to SVN retaining all of that use SubGit project:

    $ svnadmin create svn.repo
    
    $ subgit configure svn.repo
    
    $ #edit svn.repo/conf/subgit.conf ('git.default.repository' option) 
    to set path to your bare Git repository (the repository you on the server
    or you can prepare new bare repository
    with "git clone --bare <Git URL> path/to/bare/git/repo")
    
    $ #optionally prepare svn.repo/conf/authors.txt file
    to configure custom authors mapping
    
    $ subgit install
    

    After installation SubGit will synchronize and keep in sync SVN repository svn.repo and Git repository path/to/bare/git/repo, such that any commit to SVN will result in Git commit and vice versa (the synchronization is driven by hooks and concurrently-safe, so you may still continue using Git).

    To stop continous synchronization run

    $ subgit uninstall svn.repo