Working with Git against the Subversion Repository


These instructions are only valid for Repoze components which have not been migrated to Github.

How-to: Branch with Git directly from Subversion

Git ships with a git svn subcommand which allows a developer to interoperate with a project whose main repository is in Subversion. Using this plugin, you can clone the branch from its native HTTP URL:

$ cd ~/repoze
$ git svn --stdlayout clone svn+

You may check out any subdirectory of the Repoze SVN repository that has the typical SVN “branches”, “tags” and “trunk” layout. The branches, tags, and trunk will be imported into the resulting local Git repository in a sensible manner.

Inside the checkout, you can commit as usual using git, but you won’t be able to git svn dcommit the code back to Subversion unless you use an svn+ssh checkout URL (see How-to: Get a writable Subversion checkout).

How-to: Submit a patch from your Git branch

From your Git branch, you can use git format-patch to create a series of patch files, and then submit them via e-mail or the issue tracker, just as in How-to: Submit a patch from your Subversion checkout.

$ git format-patch origin -CM --subject="Cool feature" \

Git has another built-in plugin, git send-email , which you can use to automate submitting the patch files via e-mail:

$ git send-email origin -CM --subject="Cool feature" \ \
     --smtp-server=locahost --smtp-server-port=25

Please see the git-send-email documentation for directions on how to configure your mail transport properly.

How-to: Push your Git branch to a public server

As an alternative to uploading a patch from your Git branch (or e-mailing it), you can also publish your branch to a server where it can be cloned over HTTP for others to use, as well as for review and merging by the package maintainer.

Let’s ssume that you have been hacking on repoze.who, and want to publish your ‘saml-2.0’ feature branch in hopes of landing it in the next release. Let’s also assume that you have an account on GitHub, and want to publish your branch there. First, create the new empty repository on Github’s New Repository page. Give the repository the name repoze.who-saml_2.0, add a description, and hit submit.

Then, from your terminal, push your branch to the new repository:

$ git remote add github<userid>/repoze.who-saml_2.0.git
$ git push github master

Replace <userid> with your Github account ID.

Pushing to other services

According to Wikipedia’s Git article, a number of other code-hosting services support Git branches. You should be able to publish your branch to any of them in a similar way.

Pushing to your own server

You should be able to pubish your branch on any public webserver where you have space available, using the SSH protocol. E.g., assume that you have an account on, where the contents of your home directory’s htdocs directory are published under your userid:

$ git clone --bare /path/to/repoze.who-saml_2.0 repoze.who-saml_2.0.git
$ cd repoze.who-saml_2.0.git
$ touch git-daemon-export-ok
$ git --bare update-server-info
$ mv hooks/post-update.example hooks/post-update
$ cd ..
$ rsync -avz repoze.who-saml_2.0.git \<youraccount>/htdocs/

You can then use to make the branch available to others.

How-to: Request a Merge

After pushing your branch, you can include its URL in an e-mail you send to the maintainer, requesting a merge of your branch, or in a comment or description of an issue in the tracker.