User Tools

Site Tools


This is an old revision of the document!


git is a distributed version control system originally written by Linus Torvalds. The version control metadata is distributed, so every clone is a complete history of the source code. Compare this with centralized systems like SVN or CVS where, if the central repository burns down, everything is lost!

Installing git

Migrating from SVN

Install git-svn

# aptitude install git-svn

Create a temp git repo

This is where we will initially copy the SVN repository.

$ mkdir beca_lims_portal_temp
$ cd beca_lims_portal_temp

Initialize temp git repo

$ git svn init --no-metadata

Map SVN users to git

Create an authors file


mnorling = Martin Norling <>
aorth = Alan Orth <>
root = Alan Orth <>
akihara = Absolomon Kihara <>

Tell git about your authors

$ git config svn.authorsfile ~/svnauthors

Populate the temp git repo

$ git svn fetch

Clone from the temp repo

When doing a normal git clone it will take everything we want from the temporary repository, while leaving behind all the SVN cruft that was there to support the git-svn stuff.

$ cd ..
$ git clone beca_lims_portal_temp beca_lims_portal

See the commit history

You should see all your authors mapped from the SVN repository:

$ cd beca_lims_portal
$ git log


Git uses two main types of tags: lightweight and annotated. A lightweight tag is very much like a branch that doesn’t change — it’s just a pointer to a specific commit. Annotated tags, however, are stored as full objects in the Git database. They’re checksummed; contain the tagger name, e-mail, and date; have a tagging message; and can be signed and verified with GNU Privacy Guard (GPG). It’s generally recommended that you create annotated tags so you can have all this information; but if you want a temporary tag or for some reason don’t want to keep the other information, lightweight tags are available too.

Without arguments, git tag creates a "lightweight" tag that is basically a branch that never moves. Normally, you want to at least pass the -a option to create an unsigned tag.


Tagging the current version

git tag -a v0.2

Tagging a past version

Specify a certain commit by giving the commit's checksum (or the abbreviated checksum):

git tag -a v0.1 8e11e65

Pushing tags to origin

By default git push doesn't send tags to the remote origin; you have to tell it to do it manually.

Certain tag

$ git push origin v0.1

All tags

Push all tags which are not already on the remote origin:

$ git push origin --tags



Set a default editor

The editor is used when you have to enter a commit message.

    editor = vim

Colorize git output

    ui = auto
[color "branch"]
    current = yellow reverse
    local = yellow
    remote = green
[color "diff"]
    meta = yellow bold
    frag = magenta bold
    old = red bold
    new = green bold
[color "status"]
    added = yellow
    changed = green
    untracked = cyan
project_management/git.1277138803.txt.gz · Last modified: 2010/06/21 16:46 by