Version Control & Git
Geoff Ford & Craig Smith
Suncorp
According to Wikipedia:
“… is the management of changes to documents, programs, and other information stored as computer files.”
Image: http://i.ehow.com/images/GlobalPhoto/Articles/2065416/dictionary_Full.jpg
Before Version Control
File renamingCode.001CodeNov1.xml
Directories\Nov1Code
Zip filesNov1Code.zip
Nothing at all Image: http://www.stud.u-szeged.hu/Sajben.Emma/TW1128-Rock-Stars.jpg
We have moved on…
haven’t we?
Image http://yabadabadoo.files.wordpress.com/2008/03/puzzled-fred.jpg
•diff
•SCCS1970’s
•RVS
•CVS1980’s Tool
Support1990’s
DVCS (Bitkeeper,Git, etc…)
2000’s
A Brief History
Image http://www.free-background-wallpaper.com/images/Wallpapers1280/Beach-Wallpaper/Sand-Dunes-Soft.jpg
Version Control is…
Backup & restore
Synchronisation
Undo
Track changes
Sandbox / spike
Branch / merge
Not just for code
Image http://globalnerdy.com/wordpress/wp-content/uploads/2007/10/version_control_star_trek_style.jpg
Check-in&
Check-out
Branching&
Merging
SubversionSetup
Image http://blog.daemon.com.au/images/SourceImage/svnstructure.jpg
Version Control Best Practice
Use good comments
Commit often
Single vs multi project repos
Branch/tag when appropriate
Binaries/large files
Respect the trunk
Get to know your command line & client
Image http://www.improvizations.com/Portals/42614/images//best-
practice%20checklist-resized-600.jpg
• d
Visualisation: FishEye/SVNStat
Traditonal / Centralised
Version Control
Distributed Version Control
Hybrid Model
Version Control
Why Distributed Version Control?
Cheap local branches for easy experimenting
History aware merges
Full local history
Offline commits
Each working copy is a complete backup of the repository
Example DistributedVersion Control
Tools
Git (2005)http://git-scm.com
Mercurial (2005)http://mercurial.selenic.com
Bazaar (2005)http://bazaar-vcs.org
Darcs (2004)http://darcs.net
Git is Fast
Git is Efficient
git clone git://example.com/repo.git
Clone
Git Workflow
git checkout -b new-feature
Working Branch
git add .
git commit -m “Commit Message”
Commit
git rebase master
git checkout master
git merge new-feature
Rebase & Merge
git push origin
Push
git svn clone http://example.com/repo
Clone
Git + SVN Workflow
git checkout -b new-feature
Working Branch
git add .
git commit -m “Commit Message”
Commit
git rebase master
git checkout master
git merge new-feature
Rebase & Merge
git dcommit
Push to SVN
Repository Many Branches
Many Branches + Merges
LiveDemo
Want More Information?Geoff [email protected]
Craig [email protected]
References:
http://www.spearce.org/2007/07/difficult-gitk-graphs.html
http://www.infoq.com/articles/dvcs-guide http://ldn.linuxfoundation.org/article/dvcs-round-one-
system-rule-them-all-part-3 http://gaveen.owain.org/2008/05/simple-diagram-on-
distributed-vcs-hint.html http://betterexplained.com/articles/a-visual-guide-to-
version-control/ http://en.wikipedia.org/wiki/Revision_control