This document compares the decentralized version control systems Git and Mercurial. It discusses their histories, how they work in a decentralized manner without needing a central server, branching and merging workflows, and integration with development environments and tools. Key advantages noted are performance, flexibility, and popularity for Git, while Mercurial provides good multi-platform support and integration. The conclusion is that distributed version control systems are now essential for open source and will become standard in companies in the near future.
16. Initialisation du projet
$ git clone $ hg clone
https://loicfrering@github.com https://sdeleuze@bitbucket.org
/loicfrering/hello.git /sdeleuze/hello
Initialized empty Git destination directory: hello
repository in updating to branch default
/home/hello/.git/ 0 files updated, 0 files
warning: You appear to have merged, 0 files removed, 0
cloned an empty repository. files unresolved
$ cd hello $ cd hello
$ tree -aL 1 $ tree -aL 1
. .
└── .git └── .hg
1 directory, 0 files 1 directory, 0 files
17. HelloWorld.java
$ vim HelloWorld.java
$ cat HelloWorld.java
public class HelloWorld {
public static void main(String[] args) {
HelloWorld hello = new HelloWorld();
System.out.println(hello.sayHello());
}
public String sayHello() {
return "Hello World from Java!";
}
}
18. Track HelloWorld.java
$ git status -s $ hg status
?? HelloWorld.java ? HelloWorld.java
$ git add HelloWorld.java $ hg add HelloWorld.java
$ git status -s $ hg status
A- HelloWorld.java A HelloWorld.java
20. HelloWorld.php
$ vim HelloWorld.php
$ cat HelloWorld.php
<?php
class HelloWorld
{
public function sayHello()
{
return 'Hello World from PHP!';
}
}
$hello = new HelloWorld();
echo $hello->sayHello() . PHP_EOL;
27. Staging area
$ git status -s
M- HelloWorld.java
-M HelloWorld.php
$ git status
# On branch master
# Changes to be committed:
# (use "git reset HEAD <file>..." to unstage)
#
# modified: HelloWorld.java
#
# Changed but not updated:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working
directory)
#
# modified: HelloWorld.php
#
32. hello_world.rb
$ vim hello_world.rb
$ cat hello_world.rb
class HelloWorld
def sayHello(name)
"Hello " + name + " from Ruby!"
end
end
hello = HelloWorld.new
puts hello.sayHello("LyonJUG")
42. Console versus IHM
Constat :
- SVN = IHM d'abord, ligne de commande après
- Git/Mercurial = ligne de commande d'abord, IHM après
43. Intégration système Mercurial
Excellent support multi-plateformes
Support des proxy en entreprise
Intégration Windows TortoiseHg
hg serve très utile
44. Intégration système Git
Intégration Windows
msysGit / GitCheetah
Cygwin
TortoiseGit
Support Windows un cran en dessous
Support des proxy en entreprises
73. Synthèse
Performances
Multi-platforme
Branches
Formation
Support proxy
Intégration IDE
Souplesse
Popularité
74. 2010 : les DVCS sont incontournables
dans le monde Open Source
2011 : les DVCS seront
incontournables en entreprise
75. Liens
Git Reference Hg Init
Pro Git Mercurial: The definitive guide
Git community book Bitbucket
GitHub
Analysis of Git and Mercurial
DVCS: A Not-So-Quick Guide Through
Why Git is better than X where X is one of hg, bzr, svn, perforce
Notre interview sur Git et Mercurial par Agnès Crepet des JDuchess
76. Crédits
Scott Chacon : Why git is better than X
Scott Chacon : Git 101
Chris Wanstrath : Git: The Lean, Mean, Distributed Machine
Vincent Driessen : A successful Git branching model
Curtis Newton : Green light = Go / Flickr
Gource : Software version control visualization