Howto git with root svn repo (personal note)

If you want to handle the subversion repository of ROOT, here are some personal tips which may help. Hope you like it. :slight_smile:

First of all, read some tutorial of git. Git is quite easy to learn. It may only take you one or two hours, then you can play with GIT. I recommend “Pro GIT”, the free online book – progit.org/book/

The ROOT repo ( root.cern.ch/svn/root/ ) is divided into several parts as below:

branches  -- each release take one branch tree here
tags      -- Tags, as mentioned
trunk     -- The trunk directory
vendors   -- Third party codes

The simplest way to clone the repo using git is just like this:

git clone --stdlayout http://root.cern.ch/svn/root/ 

But the branch dev (dir: branches/dev/) is very special, which contains all temporary development and tests and is very big. What you may interest might be official releases, tags, and the trunk. So, you can ignore “dev” and “vendors”. Then, follow these steps:

  1. create a new directory and initialize it as a git repo
mkdir root-git
cd root-git
git init
  1. add the following lines to file .git/config
[svn-remote "svn"]
	url = http://root.cern.ch/svn/root
	ignore-paths = ^dev
	fetch = trunk:refs/remotes/trunk
	branches = branches/*:refs/remotes/*
	tags = tags/*:refs/remotes/tags/*
  1. then “git svn fetch”. After long waiting, you may get the local copy of the svn repo.

If you want to look at the dev branch, you’d better checkout each directory of “dev” as a new git branch. Your “svn-remote” section in .git/config can be changed as below:

[svn-remote "svn"]
	url = http://root.cern.ch/svn/root
	ignore-paths = ^dev
	fetch = trunk:refs/remotes/trunk
	branches = vendors/*:refs/remotes/vendors/*
	branches = branches/dev/*:refs/remotes/devel/*
	branches = branches/*:refs/remotes/*
	tags = tags/*:refs/remotes/tags/*

After “git svn fetch”, your local copy doesn’t contain tags. You can fix this using the attached script “git-fix-svn-tags.py”:

./git-fix-svn-tags.py <path-to-root-git-repo>

At last, play with the repo using git.
git-fix-svn-tags.py (1.11 KB)

Hi Exaos, Thanks for putting this useful information together.

Another tip: If one is uninterested in all of ROOT’s history (which is rather large), then you can choose a revision to import from with:

, where ${R} is the revision number you import from (which you might choose from somewhere like the ROOT ViewVC. This will make the import rather faster.