vcs ftw - edu.xored.comedu.xored.com/presentations/5-version-control-systems.pdf · git –design...

25
VCS FTW Xored Educational Program • 2016–2017 Timofey Vasenin Senior Software Engineer @ Xored, MMD NSU graduate

Upload: others

Post on 11-Oct-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

VCS FTW

Xored Educational Program • 2016–2017

Timofey Vasenin

Senior Software Engineer @ Xored,

MMD NSU graduate

Page 2: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

VCS WTF

Xored Educational Program • 2016–2017

Timofey Vasenin

Senior Software Engineer @ Xored,

MMD NSU graduate

Page 3: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

Contents

• Common terms and definitions

• VCS Evolution: Local -> Centralized -> Distributed

• A long journey: ZIP -> CVS -> SVN -> GIT

• GIT fundamentals

Xored Educational Program • 2016-2017

Page 4: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

Linear history

Xored Educational Program • 2016-2017

Page 5: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

Branching

• Commit (revision)

• Branch

• Merge

Xored Educational Program • 2016-2017

Page 6: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

Version control system (VCS)

• Keep development history

• Enable concurrent development

• Show changes between versions

• Foundation for CI

• Can be used for anything, not only for code

Xored Educational Program • 2016-2017

Page 7: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

Evolution – Local VCS

Xored Educational Program • 2016-2017

Page 8: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

Evolution – CVCS vs DVCS

Xored Educational Program • 2016-2017

Page 9: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

Evolution – CVCS vs DVCS

Xored Educational Program • 2016-2017

Page 10: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

ZIP + patches

• Snapshots + diffs

• Good for manual exchange

• Not space-efficient

• No way to easily combine patches

• Not obsolete!

Xored Educational Program • 2016-2017

Page 11: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

CVS

Xored Educational Program • 2016-2017

Page 12: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

SVN

• /trunk

• /branches/featureX

• /tags/vX.XX

• Cheap copy/move (incl. branches/tags)

• One SVN server can host multiple repos

Xored Educational Program • 2016-2017

Page 13: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

SVN

• Everything is about naming conventions

• No real branches/tags (just different folders)

• Easy to abuse

• SLOW

• Not obsolete!

Xored Educational Program • 2016-2017

Page 14: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

Git – design goals

• Patching should take no more than three seconds

• Take CVS as an example of what not to do; if in doubt, make the exact opposite decision

• Support a distributed, BitKeeper-like workflow

• Include very strong safeguards against corruption, either accidental or malicious

Xored Educational Program • 2016-2017

Page 15: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

List of deltas

Xored Educational Program • 2016-2017

Page 16: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

Stream of snapshots

Xored Educational Program • 2016-2017

Page 17: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

Git – overview

• FAST

• Distributed

• Simple data model

• Most operations are local

• Branching development strategy

• Almost no overhead for branches/tags

• Each commit is a snapshot of the entire project

• It’s important to know how it works under the hood

Xored Educational Program • 2016-2017

Page 18: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

Git – commits and refs

• Commits store their parent IDs

• Branches and tags are refs

• Ref – pointer to commit object

• Garbage-collected

Xored Educational Program • 2016-2017

Page 19: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

Git – commit anatomy

BlobTreeCommitTag

Xored Educational Program • 2016-2017

• Repository – storage for objects and refs• Synchronize with pull/push

Page 20: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

Git – 3 states

Xored Educational Program • 2016-2017

Page 21: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

Git – limitations

• Can’t rewrite history without changing IDs of all commits involved

• One repo – one project

• Not easy to sync multiple repos

• No native way to effectively store large binaries

Xored Educational Program • 2016-2017

Page 22: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

Git – code of conduct

• Config files (.gitignore, .gitattributes)

• Branch/tag naming conventions

• Commit message rules (!)

• Branching strategy (e.g. GitFlow)

Xored Educational Program • 2016-2017

Page 23: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

Git – learning

• Start off with GUI clients• SourceTree

• GitK

• IDE plugins

• Try to imagine the result before doing actual work

• Experiment!

Xored Educational Program • 2016-2017

Page 24: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

https://git-scm.com/book

Xored Educational Program • 2016-2017

Page 25: VCS FTW - edu.xored.comedu.xored.com/presentations/5-Version-Control-Systems.pdf · Git –design goals •Patching should take no more than three seconds •Take CVS as an example

Links

• http://chris.beams.io/posts/git-commit/

• http://www.slideshare.net/DrupalForumZP2012/vcs-git

• http://nvie.com/posts/a-successful-git-branching-model/

• http://www.slideshare.net/tarkasteve/understanding-git-goto-london-2015

• https://illustrated-git.readthedocs.io/en/latest/

Xored Educational Program • 2016-2017