![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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/1.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/2.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/3.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/4.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/5.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/6.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/7.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/8.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/9.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/10.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/11.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/12.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/13.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/14.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/15.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/16.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/17.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/18.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/19.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/20.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/21.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/22.jpg)
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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/23.jpg)
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 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](https://reader036.vdocuments.mx/reader036/viewer/2022071214/6043f14697efb920ee3618f4/html5/thumbnails/25.jpg)
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