2009年8月17日 星期一

Commit your git changesets into Subversion

Commit your git changesets into Subversion
  • First prepare your Subversion target folder, ex. http://svn.example.com/svn/git-backup
    $ svn mkdir --parents http://svn.example.com/svn/git-backup
  • Configure your git-svn on your original git working folder.
    $ git-svn init http://svn.example.com/svn/git-backup
  • Fetch Subversion changesets.
    $ git-svn fetch
  • Manually graft relationship.
    $ git show-ref git-svn
    8ec71dda61a3a32d9cf0c00e51a0c1ca3ea39f0e refs/remotes/git-svn
    $ git log --pretty=oneline master | tail -n1
    bcbd25a12642e98e1c54a8e51abacd85222b79a7 Your latest git commit log.
    $ echo "bcbd25a12642e98e1c54a8e51abacd85222b79a7 8ec71dda61a3a32d9cf0c00e51a0c1ca3ea39f0e" >> .git/info/grafts
  • Then push all git changesets into Subversion repository.
    $ git-svn dcommit
With Standard Layout
  • First prepare your Subversion target folder, ex. http://svn.example.com/svn/git-backup/{trunk,branches,tags}
    $ svn mkdir --parents http://svn.example.com/svn/git-backup/trunk http://svn.example.com/svn/git-backup/branches http://svn.example.com/svn/git-backup/tags
  • Configure your git-svn on your original git working folder.
    $ git-svn init --stdlayout http://svn.example.com/svn/git-backup
  • Fetch Subversion changesets.
    $ git-svn fetch
  • Manually graft relationship.
    $ git show-ref trunk
    8ec71dda61a3a32d9cf0c00e51a0c1ca3ea39f0e refs/remotes/git-svn
    $ git log --pretty=oneline master | tail -n1
    bcbd25a12642e98e1c54a8e51abacd85222b79a7 Your latest git commit log.
    $ echo "bcbd25a12642e98e1c54a8e51abacd85222b79a7 8ec71dda61a3a32d9cf0c00e51a0c1ca3ea39f0e" >> .git/info/grafts
  • Then push all git changesets into Subversion repository.
    $ git-svn dcommit

沒有留言: