Planet
navihomeaboutscreenshotsdownloaddevelopmentforum

Using Git for Orxonox

Git may be used by experienced users, who want to use Git's advanced features for developing Orxonox. This page describes how to use git-svn together with Orxonox' SVN.

Initial Checkout

via Adi's git repository

You can clone from Adi's Git repository from his Tardis account which is much faster than getting each commit via SVN. This requires SSH access on Tardis.

# We are not using git clone here, because we want to track some other references
git init orxonox
cd orxonox
# You may omit the host name and the colon if you are doing this on a Tardis computer
git remote add origin login.ee.ethz.ch:~adrfried/orxonox.git
git config --replace-all remote.origin.fetch '+refs/remotes/svn/*:refs/remotes/svn/*'
git fetch
# Checkout SVN trunk as the local master branch
git checkout -b master svn/trunk

Now you may initialize git-svn. You may also do this at a later point and just use Git without git-svn for now.

# Initialize git-svn
git svn init --stdlayout --prefix=svn/ https://svn.orxonox.net/game/code
# Get the latest changes from SVN in the current branch and rebase all local changes onto it
git svn rebase

Directly from SVN

Alternatively you may also checkout Orxonox' SVN-Repository in Git directly.

git svn clone --stdlayout --prefix=svn/ https://svn.orxonox.net/game/code orxonox

This will check out the whole history of the Project code with all the branches and tags, it will use about 150 MB of disk space and it may take a long time (while checking out it will use more disk space, until things get automatically compressed by git gc).

--stdlayout tells git-svn to follow the common "trunk/branches/tags" layout. --prefix=svn/ prefixes the remote branches with svn/, similar to the usual origin/, otherwise you would not be able to have a local branch with the same name as in svn.

Basic Git Configuration

Set your full name and email address.

git config --global user.name "Your Name Comes Here"
git config --global user.email you@yourdomain.example.com

Some fancy colors.

git config --global color.ui auto

The --global argument tells git to store the config in .gitconfig in your home, so these will be usable for every git repository you have.

Basic Usage

Get the latest changes from SVN in the current branch and rebase all local changes onto it.

git svn rebase

Commit local changes and push them to the SVN.

git commit -a
git svn dcommit

Branches

To checkout another branch than trunk, e.g. the presentation branch use:

git checkout -b presentation3 svn/presentation3
git svn rebase

This will create a local branch named presentation3. You can simply switch between local branches with git checkout <branch>

Create a branch of the current branch in SVN and check it out in Git:

git svn branch mybranch
git checkout -b mybranch svn/mybranch

Documentation

To learn more about git see:  http://git-scm.com/documentation