Git-SVN: Update Git repo from centralized SVN server

Best way to work on a Subversion Repository via Git:

  1. git svn init -s https://svn.repo/app/ myrepo assuming that under https://svn.repo/app/ the repo contains the standard /trunk, branches and tags subdirectories
  2. Do a git svn fetch in myrepo until no more commits are fetched (may take quite some time and sometimes aborts under Windows).
  3. Checkout a specific Subversion branch or trunk via git checkout -b trunk remotes/trunk

Then you can simply browse, hack and commit into your Git Repo containing all Subversion commits and branches.

  • To pull in new commits from SVN use git svn rebase
  • To push your local commits into SVN use git svn dcommit

To jump to a specific Subversion revision you only need to browse the history via git log and search for a commit mirroring the according subversion commit. You can easily spot the Subversion revision in the git-svn-id: line of the commit message. The just use a git checkout <commithash> to explicitly checkout that version.

Leave a Comment

tech