Vous êtes sur la page 1sur 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
• http://www.lullabot.com/blog/git-coming-
soon-drupalorg
The many Git
Workflows
Dictator and Lieutenant
dictator
blessed repository

lieutenant

lieutenant

developer developer developer developer

http://peepcode.com/products/git-internals-pdf
Integration Manager
blessed repository developer public developer public developer public

integration manager developer private developer private developer private

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

developer developer

developer shared repository 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

• GitX http://gitx.frim.nl/
• GITK http://git-scm.com/
Online Resources
• http://git-scm.com/
• http://progit.org/
• http://www.kernel.org/pub/software/scm/
git/docs/
• http://www.kernel.org/pub/software/scm/
git/docs/user-manual.html
• http://www.gitready.com/
Books

• Version Control with Git http://oreilly.com/catalog/9780596520137

• Pro Git http://progit.org/

• Git Internals http://peepcode.com/products/git-internals-pdf


Drupal Related
Resources

• http://drupal.org/handbook/git

Vous aimerez peut-être aussi