Using git-svn to interact with SVN repositories

Imagine you are a Git user and you have to work with an SVN repository. Tragically, you are now incapable of working without cheap and easy branching, disconnected operation, and all the other things that make Git great.

git-svn is a gateway that lets you interact with SVN repositories while using Git for all your local commits. It has the advantage of needing no extra configuration on the SVN server end.

To create a repository:

$ mkdir myproject; cd project
$ git-svn clone svn+ssh://me@remotehost/path/to/svn/repo

This may take a while, but you now have a bona fide Git archive with the full project history (which is not something that an SVN checkout contains).

Note: this is for a repository with no trunk and branches directories.

Your typical workflow will now looks like this.

Get remote changes:

$ git-svn rebase

Do all your Git business locally: edit, diff, commit, branch, and merge.

To push your changes back to the SVN repo:

$ git-svn dcommit

Individual commits in Git are pushed in order as separate commits to the SVN repo.

Further reading: git-svn documentation

No comments:

Post a Comment