A brief description of why decentralised version control (Git, Mercurial, etc) is superior to centralised version control (SVN, CVS, etc), written with SVN users in mind.
136 ultra-fast slides, 10-20 minutes of presentation
2. Note / disclaimer: these slides may be shared as
a PDF for the sake of interoperability, but they are
intended to be seen as an animation. It is recommended
to disable the “Continuous View” feature of your
PDF reader so you can see one slide at a time.
47. ● Being slow is not only a nuisance
● It provides a unconsciously powerful
incentive to use version control sparingly
instead of profusely (as it should)
● “I just changed a line, there is no need
to commit yet”
● “I will fix this other thing first and then
commit all”
● Wrong: commits should be atomic
● Remember that the main use of version
control is finding bugs retroactively.
The smaller the commits, the better.
49. ● But the network is not always there!
– Planes, mountain retreats, 3G/4G
failures, airports, bad hotels...
● What do you do when you do not have
network connectivity?
– Do you stop working?
– Or do you stop using version control
and then commit a huge 200-lines
commit fixing five bugs and adding
two features?
50. ● But the network is not always there!
– Planes, mountain retreats, 3G/4G
failures, airports, bad hotels...
● What do you do when you do not have
network connectivity?
– Do you stop working?
– Or do you stop using version control
and then commit a huge 200-lines
commit fixing five bugs and adding
two features?
– Both options are wrong!
71. ● ...which means version control is...
– fast,
– works offline,
– and scales!
● It also means that setting a new git repo
is trivial!
● To start working with SVN you need to
put up a server or to have access to a
server. In git you just say 'git init' and
you are ready to go!
72. FAST: commits are local, so they
are instantaneus and cheap
git commit
82. git pull = git checkout + git merge
Beware! This “git checkout” does not mean exactly the
same as “svn checkout”, it only means “get all the
commits from that machine”, it does not start a local
repository as in SVN.
83. Most of the time, most people just pull
(instead of first checking out and then merging)
104. Is SVN you must trust
everybody
because everybody can
mess up everybody else
105. Is SVN you must trust
everybody
because everybody can
mess up everybody else
(e.g. committing code
106. Is SVN you must trust
everybody
because everybody can
mess up everybody else
(e.g. committing code
but forgetting that new file
and then nothing compiles)
107. In Git you must only trust
your “selected few”, the few
people you pull from.
111. and the issue is fixed
before it spreads
to the whole community.
112. ● The only way of doing this in SVN is by
not using SVN
– Some people have access to the server
and some do not
– Code reviews are performed out-of-the-
system before committing is allowed
– Political battles for access to the server
– etc
118. Your machine burnt in a fire?
Stolen? Eaten by your dog?
No problem!
Just clone from somebody and
you have everything again!
(except those things you had not pushed today, of course)
119. In centralised systems like SVN
the server is a central point
of failure. If you lose the server,
you lose all your history, your
branches, all your version control.
120. Sure, having the whole history on every
single repo uses a lot of disk space!
121. But when was the last time you
filled up a hard disk by writing code?
(not downloading movies) ;-)
125. In summary...
● Distributed version control is great
because:
– It is fast
– It is local (no network)
– It scales seamlessly
126. In summary...
● Distributed version control is great
because:
– It is fast
– It is local (no network)
– It scales seamlessly
– It is safer
127. In summary...
● Distributed version control is great
because:
– It is fast
– It is local (no network)
– It scales seamlessly
– It is safer
● And if that were not enough to never look at
SVN again, Git also:
128. In summary...
● Distributed version control is great
because:
– It is fast
– It is local (no network)
– It scales seamlessly
– It is safer
● And if that were not enough to never look at
SVN again, Git also:
– Makes creating, managing, and merging branches
very easy
129. In summary...
● Distributed version control is great
because:
– It is fast
– It is local (no network)
– It scales seamlessly
– It is safer
● And if that were not enough to never look at
SVN again, Git also:
– Makes creating, managing, and merging branches
very easy
– Makes repository creation trivial
131. Quick SVN->Git translation
● Getting a copy of a repository
– In SVN, 'svn checkout'
– In Git, 'git clone'
– No big differences here
132. Quick SVN->Git translation
● Committing new code
– In SVN, 'svn commit'
– In Git, 'git commit'
– But we have seen that git's commit is
● local
● very fast
133. Quick SVN->Git translation
● Committing new code publicly
– In SVN, 'svn commit'
– In Git, 'git push'
– Commits are local in Git, and that (usually) means non-visible
– In other to publish them to other team members, they have to
be pushed to a well-known location
– Pushing is slow, like svn-commit, but it only happens once or
twice per day, typically.
– In SVN, your commit reaches everyone. In Git it reaches only
people who trust you enough to pull from you.
134. Quick SVN->Git translation
● Getting code written by others
– In SVN, 'svn update'
– In Git, 'git pull'
– No big differences here either, but
● in SVN, you always pull from the server
● in Git, you can pull from different people's (from their
machines, from their GitHub's account, or similar)
135. Quick SVN->Git translation
● Most other commands have similar
syntaxes to SVN's
– There are also a lot of new commands, but clone + commit +
+ push + pull will be 95% of your use of Git
– Remember: 'git help <command>' is always your friend