version control - university of toronto
TRANSCRIPT
![Page 1: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/1.jpg)
Version Control
SNUG TechTalk
SciNetwww.scinet.utoronto.caUniversity of Toronto
Toronto, Canada
October 13, 2010
![Page 2: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/2.jpg)
Outline
1 Version Control
2 Software
3 Examples
![Page 3: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/3.jpg)
Version Control
What is it?
A tool for managing changes in a set of files.
Figuring out who broke what where and when.
Why Do it?
Collaboration
Organization
Track Changes
Faster Development
Reduce Errors
![Page 4: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/4.jpg)
Version Control
What is it?
A tool for managing changes in a set of files.
Figuring out who broke what where and when.
Why Do it?
Collaboration
Organization
Track Changes
Faster Development
Reduce Errors
![Page 5: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/5.jpg)
Version Control
What is it?
A tool for managing changes in a set of files.
Figuring out who broke what where and when.
Why Do it?
Collaboration
Organization
Track Changes
Faster Development
Reduce Errors
![Page 6: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/6.jpg)
CollaborationWith others and yourself
Questions
What if two (or more) people want to edit the same file at thesame time?
What if you work on SciNet and on your own computer?
Answers
Option 1: make them take turns
But then only one person can be working at any timeAnd how do you enforce the rule?
Option 2: patch up differences afterwards
Requires a lot of re-workingStuff always gets lost
Option 3: Version Control
![Page 7: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/7.jpg)
CollaborationWith others and yourself
Questions
What if two (or more) people want to edit the same file at thesame time?
What if you work on SciNet and on your own computer?
Answers
Option 1: make them take turns
But then only one person can be working at any timeAnd how do you enforce the rule?
Option 2: patch up differences afterwards
Requires a lot of re-workingStuff always gets lost
Option 3: Version Control
![Page 8: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/8.jpg)
CollaborationWith others and yourself
Questions
What if two (or more) people want to edit the same file at thesame time?
What if you work on SciNet and on your own computer?
Answers
Option 1: make them take turns
But then only one person can be working at any timeAnd how do you enforce the rule?
Option 2: patch up differences afterwards
Requires a lot of re-workingStuff always gets lost
Option 3: Version Control
![Page 9: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/9.jpg)
CollaborationWith others and yourself
Questions
What if two (or more) people want to edit the same file at thesame time?
What if you work on SciNet and on your own computer?
Answers
Option 1: make them take turns
But then only one person can be working at any timeAnd how do you enforce the rule?
Option 2: patch up differences afterwards
Requires a lot of re-workingStuff always gets lost
Option 3: Version Control
![Page 10: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/10.jpg)
CollaborationWith others and yourself
Questions
What if two (or more) people want to edit the same file at thesame time?
What if you work on SciNet and on your own computer?
Answers
Option 1: make them take turns
But then only one person can be working at any timeAnd how do you enforce the rule?
Option 2: patch up differences afterwards
Requires a lot of re-workingStuff always gets lost
Option 3: Version Control
![Page 11: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/11.jpg)
CollaborationWith others and yourself
Questions
What if two (or more) people want to edit the same file at thesame time?
What if you work on SciNet and on your own computer?
Answers
Option 1: make them take turns
But then only one person can be working at any timeAnd how do you enforce the rule?
Option 2: patch up differences afterwards
Requires a lot of re-workingStuff always gets lost
Option 3: Version Control
![Page 12: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/12.jpg)
CollaborationWith others and yourself
Questions
What if two (or more) people want to edit the same file at thesame time?
What if you work on SciNet and on your own computer?
Answers
Option 1: make them take turns
But then only one person can be working at any timeAnd how do you enforce the rule?
Option 2: patch up differences afterwards
Requires a lot of re-workingStuff always gets lost
Option 3: Version Control
![Page 13: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/13.jpg)
Organize and Track Changes
Question
Want to undo changes to a file
Start work, realize it’s the wrong approach, want to get backto starting pointLike ”undo” in an editor......but keep the whole history of every file, forever
Also want to be able to see who changed what, when
The best way to find out how something works is often to askthe person who wrote it
Answer
Version Control
![Page 14: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/14.jpg)
Organize and Track Changes
Question
Want to undo changes to a file
Start work, realize it’s the wrong approach, want to get backto starting pointLike ”undo” in an editor......but keep the whole history of every file, forever
Also want to be able to see who changed what, when
The best way to find out how something works is often to askthe person who wrote it
Answer
Version Control
![Page 15: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/15.jpg)
Organize and Track Changes
Question
Want to undo changes to a file
Start work, realize it’s the wrong approach, want to get backto starting pointLike ”undo” in an editor......but keep the whole history of every file, forever
Also want to be able to see who changed what, when
The best way to find out how something works is often to askthe person who wrote it
Answer
Version Control
![Page 16: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/16.jpg)
Organize and Track Changes
Question
Want to undo changes to a file
Start work, realize it’s the wrong approach, want to get backto starting pointLike ”undo” in an editor......but keep the whole history of every file, forever
Also want to be able to see who changed what, when
The best way to find out how something works is often to askthe person who wrote it
Answer
Version Control
![Page 17: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/17.jpg)
How it Works
![Page 18: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/18.jpg)
How it Works
![Page 19: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/19.jpg)
How it Works
![Page 20: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/20.jpg)
How it Works
![Page 21: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/21.jpg)
How it Works
![Page 22: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/22.jpg)
How it Works
![Page 23: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/23.jpg)
How it Works
![Page 24: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/24.jpg)
How it Works
![Page 25: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/25.jpg)
How it Works
Resolving Conflicts: Optimistic Concurrency
Milk<<<<<<<Cheese=======Hot Dog>>>>>>>Juice
![Page 26: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/26.jpg)
What to Use
Software
Open Source
Subversion, CVS, RCSGit, Mercurial, Bazaar
Commercial
Perforce, ClearCase
available as modules on SciNet
![Page 27: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/27.jpg)
Software
Subversion (svn)
Centralized Version Control
Replaces CVS
Lots of web and GUI integration
Users: GCC, KDE, FreeBSD
Git
Distributed Version Control
*nix command line driven design model
advanced features git-stash, git-rebase,git-cherry-pick
Users: Linux kernel, GNOME, Wine, X.org
![Page 28: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/28.jpg)
Distributed vs. Centralized
![Page 29: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/29.jpg)
Distributed vs. Centralized
![Page 30: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/30.jpg)
Distributed vs. Centralized
![Page 31: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/31.jpg)
Distributed vs. Centralized
Centralized (svn)
Pros
Single RepositoryAccess ControlsPredictable Revision NumbersGUI’sSimple to understand
Cons
Online to accessTypically SlowerMerges can be painful
![Page 32: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/32.jpg)
Distributed vs. Centralized
Distributed (git)
Pros
Simple setup and lightweightDistributedVery FastBranch and merging easierSub collaboration
Cons
Revision numberingCan be complicated conceptuallyNot backed up
![Page 33: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/33.jpg)
New Repo: Subversion
Initialize
# svnadmin create /path/svn
Create a Repository
# svn import /path/project \/path/svn/project/trunk -m ’Initial import’
# svn checkout /path/project/
Make Changes
# vi list.txt# svn ci -m "modified list.txt"# svn status
![Page 34: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/34.jpg)
New Repo: Git
Initialize# git config --global user.name "SciNet User"# git config --global user.email [email protected]
Create a Repository
# cd ~user/code/# git init# git add .# git commit -m "create a git repo of my code"
Make Changes
# vi list.txt# git commit -a -m "modified list.txt"# git status
![Page 35: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/35.jpg)
Existing Repo: Subversion
Checkout a Project
# svn checkout /path/project/
Make Changes
# vi list.txt# svn ci -m "modified list.txt"# svn status
![Page 36: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/36.jpg)
Existing Repo: Git
Checkout a Project
# cd ~user/code/# git clone /path/project/# git checkout master
Make Local Changes
# vi list.txt# git commit -a -m "modified list.txt"
Publish Changes
# git pull (fetch & merge)# git push
![Page 37: Version Control - University of Toronto](https://reader031.vdocument.in/reader031/viewer/2022020621/61e7430303af9411bc049a44/html5/thumbnails/37.jpg)
References
Links
Git http://git-scm.com/
Subversion http://subversion.tigris.org/