Version 7 (modified by pv, 4 years ago)

--

There are automatically updated git mirrors of Numpy (and Scipy) on github:

One can also be found here:

I won't talk about how to use git, only some points to keep in mind when using the mirror. There is a lot of resources to learn git on the web.

Download the git

Cloning the repository is straightforward:

git clone git://github.com/cournape/numpy.git

Importing svn meta-data

Unfortunately, the clone command of git does not copy the svn metadata by default. To do so, you have to do the following for each clone:

Get the SVN branches

Edit .git/config to look something like this:

[remote "origin"]
	url = git://github.com/pv/numpy-svn.git
	fetch = +refs/remotes/*:refs/remotes/*
[branch "master"]
	remote = origin
	merge = refs/remotes/trunk

This ensures that you get the most recent SVN branch pointers when you run git fetch.

Alternatively, execute the following command to get them only once:

git fetch git://github.com/cournape/numpy.git +refs/remotes/*:refs/remotes/*

This will tell git to download all the svn branch/tags info available on the git mirror just this time.

Configure git-svn

If you want to commit back to SVN, or to get changes directly from SVN, you need to configure git-svn for the clone:

Edit your .git/config, and add the follwing:

[svn-remote "svn"]
        url = http://svn.scipy.org/svn/numpy
        fetch = trunk:refs/remotes/trunk
        branches = branches/*:refs/remotes/*
        tags = tags/*:refs/remotes/tags/*

This tells git-svn where to get svn meta-data.

To update the svn metadata, run:

git checkout master && git svn rebase -l

This should be reasonably fast.

Using the git clone

Create a branch

There is one rule to always remember: NEVER WORK ON A SVN BRANCH DIRECTLY, ALWAYS ON A BRANCH MADE FROM IT! Concretely, if you want to work on the trunk

# Make a branch 'work' based on trunk, and switch to it
git checkout -b work trunk

Committing to svn

If you have set up git-svn as instructed above, you can commit back to the scipy svn repository with git svn dcommit:

git svn dcommit

Before actually committing, it is a good idea to check whether you are committing where you think you are committing (with the dry run option of git svn dcommit):

git svn dcommit -n

Updating from numpy svn repository

Use the rebase command. For example, updating the trunk is a matter of:

git checkout trunk
git svn rebase -l