You are on page 1of 17

Git

A Distributed Revision Control System

Drupal User Group Switzerland

2010-09-01

Matias E. Fernandez

History

Developed by Linus Torvalds

First version in 2005

Maintained by Junio Hamano

Key Advantages

It’s very fast!

Excellent native support of distributed development paradigm

Collaboration can occur over many media:

SSH, HTTP,WebDAV, FTP, or emails (no need to open special port)

Key Advantages

Branching/merging is a native central concept

Robustness: internal file formats are very simple; corruption is very rare and recovery very simple

Why Drupal chose Git?

Three initial candidates: Mercurial, Bazaar and Git

The discussion: http://groups.drupal.org/

node/48818

The many Git Workflows

Dictator and Lieutenant

dictator blessed repository lieutenant lieutenant developer developer developer developer
dictator
blessed repository
lieutenant
lieutenant
developer
developer
developer
developer

Integration Manager

blessed repository developer public developer public developer public integration manager developer private
blessed repository
developer public
developer public
developer public
integration manager
developer private
developer private
developer private

Central Repository

developer shared repository developer
developer
shared repository
developer
Central Repository developer shared repository developer developer developer developer developer developer developer
Central Repository developer shared repository developer developer developer developer developer developer developer
developer
developer
developer
developer
developer
developer
developer
developer
developer
developer
developer developer developer developer developer developer developer http://peepcode.com/products/git-internals-pdf
developer
developer
developer developer developer developer developer developer developer http://peepcode.com/products/git-internals-pdf

Setting up Git

git config

$ git config --global user.name “Matias E. Fernandez”

$ git config --global user.email “pisco@drupal.org”

$ git config --global color.ui auto

git init

$ git init

git add

$ git add .

git commit

$ git commit -m ‘my first commit’

Working with Branches

git branch

$ git branch -al

$ git brach -d mybranch

git checkout

$ git checkout myotherbranch

$ git checkout -b mynewbranch

git stash

$ git stash

$ git stash apply

$ git stash clear

Sharing Code

git clone

$ git clone git://git.drupalcode.org/projects/drupal.git

git push

$ git push origin

RTFM!

Git has an extensive and very thorough documentation: use it!

$ git help [command]

Git Tools

Drupal Related Resources