5. 1. Evolution of revision control systems
* RCS -> CVS -> SVN
* Single repository for the history
* Working copy of a file
* Only one developer can commit at a time
* Complicated merges
RCS/CVS/SVN ARE YOUR
ENEMY
6. 2. Distributed version control systems(DVCS)
* Locally accessible history
* Every developer can commit at will
* Every client can become a server (no single
server required)
* Seamless merges
9. Integration-Manager Workflow
Project's Developer Developer Developer
repository public public public
Integration
manager
Developer Developer Developer
private private private
10. Dictator Workflow
kernel.org
Sub tree
maintainer
Sub tree
maintainer
Sub tree
maintainer
developer
developer
developer
developer developer
developer
11. Dictator Workflow
kernel.org
Sub tree
maintainer
Sub tree
maintainer
Sub tree
maintainer
developer
developer
developer
developer developer
developer
14. init
[root@Beast git]# time git init
Initialized empty Git repository in .git/
real 0m0.129s
user 0m0.000s
sys 0m0.000s
[root@Beast hg]# time hg init
real 0m0.204s
user 0m0.020s
sys 0m0.010s
[root@Beast hg]#
15. add
[root@Beast git]# time git add file0
real 0m0.016s
user 0m0.000s
sys 0m0.000s
[root@Beast hg]# time hg add file0
real 0m0.098s
user 0m0.030s
sys 0m0.010s
16.
17. status
[root@Beast git]# time git status
# On branch master
#
# Initial commit
#
# Untracked files:
# (use "git add <file>..." to include in what will be
committed)
#
# file0
nothing added to commit but untracked files present
(use "git add" to track)
real 0m0.034s
user 0m0.000s
sys 0m0.000s
19. commit
[root@Beast git]# time git commit -m
'added file0' file0
Created initial commit 43bb00d: added file0
1 files changed, 1 insertions(+), 0
deletions(-)
create mode 100644 file0
real 0m0.047s
user 0m0.000s
sys 0m0.000s
20. commit
[root@Beast hg]# time hg commit -m
'added file0' file0
No username found, using
'root@Beast.yuhu.biz' instead
real 0m0.218s
user 0m0.030s
sys 0m0.000s
21.
22. status
[root@Beast hg]# hg status
[root@Beast git]# git status
# On branch master
nothing to commit (working directory clean)
31. $ hg l og
changeset :
t ag:
4: 2278160e78d4
ti p
the hg way
user : Br yan O' Sul l i van < bos@ pent i ne. com
ser >
dat e: Sat Aug 16 22: 16: 53 2008 + 0200
sum ar y:
m Tr i m com ent s.
m
changeset : 3: 0272e0d5a517
user : Br yan O' Sul l i van < bos@ pent i ne. com
ser >
dat e: Sat Aug 16 22: 08: 02 2008 + 0200
sum ar y:
m Get m ake t o gener at e t he f i nal bi nar y
f r om a . o f i l e.
changeset : 2: f ef 857204a0c
user : Br yan O' Sul l i van < bos@ pent i ne. com
ser >
dat e: Sat Aug 16 22: 05: 04 2008 + 0200
sum ar y:
m I nt r oduce a t ypo i nt o hel l o. c.
changeset : 1: 82e55d328c8c
user : m @ eni c. com
pm sel
dat e: Fr i Aug 26 01: 21: 28 2005 - 0700
sum ar y:
m Cr eat e a m akef i l e
changeset : 0: 0a04b987be5a
user : m @ eni c. com
pm sel
dat e: Fr i Aug 26 01: 20: 50 2005 - 0700
sum ar y:
m Cr eat e a st andar d " hel l o, w l d" pr ogr am
or
32. the hg way
$ hg log -r 3
changeset: 3:0272e0d5a517
user: Bryan O'Sullivan <bos@serpentine.com>
date: Sat Aug 16 22:08:02 2008 +0200
summary: Get make to generate the final binary from a .o file.
$ hg log -r 0272e0d5a517
changeset: 3:0272e0d5a517
user: Bryan O'Sullivan <bos@serpentine.com>
date: Sat Aug 16 22:08:02 2008 +0200
summary: Get make to generate the final binary from a .o file.
$ hg log -r 1 -r 4
$ hg log -r 2:4
$ hg log -v -p -r 2
33. $ gi t l og the git way
com i t ca82a6df f 817ec66f 44342007202690a93763949
m
Aut hor : Scot t Chacon < schacon@ gee- m l . com
ai >
Dat e: Mon M ar 17 21: 52: 11 2008 - 0700
changed t he ver si on number
com i t 085bb3bcb608e1e8451d4b2432f 8ecbe6306e7e7
m
Aut hor : Scot t Chacon < schacon@ gee- m l . com
ai >
Dat e: Sat M ar 15 16: 40: 33 2008 - 0700
r emoved unnecessar y t est code
com i t a11bef 06a3f 659402f e7563abf 99ad00de2209e6
m
Aut hor : Scot t Chacon < schacon@ gee- m l . com
ai >
Dat e: Sat M ar 15 10: 31: 28 2008 - 0700
f i r st com i t
m
34. $ gi t l og m er ~
ast 2
$ gi t l og m er ~ . m er ~
ast 2. ast 4
$ gi t l og m er ^ 1 = gi t l og
ast 1^ =
m er ~
ast 2
$ gi t l og m er ^
ast 2
$ gi t l og -p
$ gi t l og – si nce= w2. eeks
$ gi t l og - - col or the git way
36. [ r oot @Beast gi t ] # cat f i l e1
l i ne1
[ r oot @Beast gi t ] # echo ' l i ne2' >>
f i l e1
[ r oot @Beast gi t ] # gi t di f f
di f f - - gi t a/ f i l e1 b/ f i l e1
i ndex a29bdeb. . c0d0f b4 100644
- - - a/ f i l e1
+ + b/ f i l e1
+
@ -1 + 2 @
@ 1, @
l i ne1
+ i ne2
l
37. [ r oot @Beast hg] # cat f i l e1
l i ne1
[ r oot @Beast hg] # echo ' l i ne2' >>
f i l e1
[ r oot @Beast hg] # hg di f f
di f f - r d2cf a0a39f b6 f i l e1
- - - a/ f i l e1 Sun Apr 25 05: 32: 01
2010 + 0300
+ + b/ f i l e1
+ Sun Apr 25 05: 32: 19
2010 + 0300
@ - 1, 1 + 2 @
@ 1, @
l i ne1
+ i ne2
l
38. grep
* search only the project
* search trough the working copy
[ r oot @ Beast hg] # hg gr ep l i ne
f i l e1: 6: l i ne1
[ r oot @ Beast gi t ] # gi t gr ep l i ne
f i l e1: l i ne1
f i l e1: l i ne2
39.
40. $ gi t cl one di r
$ gi t cl one gi t : / / host / di r
$ gi t cl one ht t p( s) : / / host / di r
$ gi t cl one r sync: / / [ user @ host / di r
]
$ gi t cl one ssh: / / [ user @ host ] / di r
ssh onl y: gi t cl one [ user @ host : di r
]
41. $ hg cl one ht t p: / / host / di r
$ hg cl one ssh: / / [ user @ host / di r
]
47. branching
GIT
HEAD – poi nt s t o t he most r ecent
com i t
m i n t he cur r ent br anch
m er
ast – a speci al nam br anch
ed
Mercurial
t i p – poi nt s t o t he most r ecent
com i t
m
H ead – i s t he t i p or t he t i ps of
m gi ng br anches
er
48. branching
GIT
$ gi t br anch br anch_ name
$ gi t checkout br anch_ nam e
Mercurial
$ hg br anch br anch_ name
$ hg updat e br anch_ name
49. tags vs. branches
* Tags i n m cur i al ar e synonym t o
er s
a changeset
* Tags i n m cur i al ar e ver si on
er
cont r ol l ed
* Tags i n gi t ar e onl y a sym i nk t o
l
a com i t
m
* Tags i n gi t ar e onl y l ocal
* Br anches i n bot h ar e used f or
cont i nues devel opment
51. Blame / annotate
$ hg annot at e - u - d - c - l mysql
f l or i an 07b950dc7279 Tue M ar 02 . . . : 1: # / bi n/ sh
!
beekhof 67234f 982ab7 Thu J ul 05 . . . : 2: #
f l or i an 01a181a4165c Fr i Apr 02 . . . : 3: #
beekhof 67234f 982ab7 Thu J ul 05 . . . : 4: #M LySQ
beekhof 67234f 982ab7 Thu J ul 05 . . . : 5: #
beekhof 67234f 982ab7 Thu J ul 05 . . . : 6: #D escr i pt i on:
M anages a M L ySQ
beekhof 67234f 982ab7 Thu J ul 05 . . . : 8: #
f l or i an 380982a15dc8 Fr i Apr 23 . . . : 8: # Aut hor s: Al an
Rober t son:
f l or i an 380982a15dc8 Fr i Apr 23 . . . : 9: # J akub
J anczak:
f l or i an 380982a15dc8 Fr i Apr 23 . . . : 10: # Andr ew
Beekhof :
f l or i an 380982a15dc8 Fr i Apr 23 . . . : 11: #
Sebast i an Rei t enbach:
52. $ gi t bl am haw pl
e k.
^0e22116 ( r oot 2008- 07- 09 ... 1) # / usr / bi n/ per l - T
!
a5062333 ( val 2009- 06- 10 ... 2)
^0e22116 ( r oot 2008- 07- 09 ... 3) use st r i ct ;
^0e22116 ( r oot 2008- 07- 09 ... 4) use w ni ngs;
ar
37f b4989 ( val 2009- 06- 01 ... 5)
a5062333 ( val 2009- 06- 10 ... 6) use D : : m
BD ysql ;
a5062333 ( val 2009- 06- 10 ... 7) use PO X qw set si d) ,
SI (
qw W O AN ) ;
( NH G
..........
a5062333 ( val 2009- 06- 10 ... 12) i m t par se_ conf i g;
por
6ad3f f 60 ( val 2009- 06- 19 ... 13) i m t post _ a_ not e;
por
^0e22116 ( r oot 2008- 07- 09 ... 14)
^0e22116 ( r oot 2008- 07- 09 ... 15) # syst em var i abl es
^0e22116 ( r oot 2008- 07- 09 ... 16) $ENV{PATH = ' ' ;
}
7868b7e1 ( val 2010- 04- 23 ... 17) m $VERSI O = ' 2. 1. 0' ;
y N
^0e22116 ( r oot 2008- 07- 09 ... 18)
^0e22116 ( r oot 2008- 07- 09 ... 19) # def i ni ng f aul t hashes
$ gi t bl am - L 16, 18 haw pl
e k.
$ gi t bl am - L / use st r i ct / , / use D / haw pl
e BD k.