Code Management (Version Control)
-
Upload
y-thong-kuah -
Category
Technology
-
view
1.936 -
download
8
description
Transcript of Code Management (Version Control)
Code Management
ChangeChange
ChangeChange
Common code problems
Where is that file?
ChangeWhere is everything?
What just
broke?
Who dunnit?
I'm sure nothing's changed
Code Management
ChangeFix it now
Messy Messy fixesfixes
PatchworkPatchworkofof
changeschanges
Change
Where is that file? Where is that bug? Who last changed this file?
Who made that change, when and why?
Has the code changed or not? How is it different?
Can you put your fixes into my files? Messy fixes
...
Change
How to manage change?
How?
Tools&
Practices
Practices is up to you & team
Tools
Tools
SVNGit
Basics
You get codeYou change codeYou share your changes
Basics
You checkoutYou change codeYou commit
Basics
You checkout
Checkout
svn co list.txt (get latest version)
Basics
You checkoutYou change code
Change code
...change file...
Basics
You checkoutYou change codeYou commit
Commit
svn commit list.txt (check in your version
Again?
Checkout
svn co list.txt (get latest version)
Change code
...change file...
Commit
svn commit list.txt (check in your version
Every version is recorded
Every change is recorded
Sharing is good
Basics (II)
Others get your codeOthers change codeYou get new version
Basics (II)
Others checkoutOthers change codeYou update
Basics (II)
Others checkoutOthers change codeYou updateAnd around it goes
Where?
Repository
Central place
Repository
Central place Does versioning for you
Repository
Central place Does versioning for you
Handles changes from multiple sources
Summary
Change happensUse best practiceUse toolsSource control basics
Further Information
Other SCM tools (decentralised) Integration into IDEs Integration with testing, release, tracker SVN Red Book http://betterexplained.com/articles/a-visual-
guide-to-version-control/ http://www.swc.scipy.org/lec/version.html
Credits, Attribution http://www.flickr.com/photos/vespa_gt/373805114/sizes/m/
http://www.flickr.com/photos/ezu/277341190/sizes/o/
http://www.flickr.com/photos/addedentry/2222911325/
http://www.flickr.com/photos/charlieferrari/49323751/sizes/o/
http://www.flickr.com/photos/aliciayeah/262229883/sizes/l/
http://www.flickr.com/photos/nickwheeleroz/2475011402/sizes/l/
http://www.flickr.com/photos/herzogbr/2123789106/sizes/l/
http://www.flickr.com/photos/sgt_spanky/2470700936/
http://www.flickr.com/photos/striatic/340190783/
http://www.flickr.com/photos/7506006@N07/513417996/in/set-72157600264508078/
http://www.flickr.com/photos/7506006@N07/513453021/
http://www.flickr.com/photos/mattwright/1787856/sizes/l/
http://www.flickr.com/photos/ryanr/142455033/sizes/o/
http://www.flickr.com/photos/tjflex/233574885/sizes/l/
http://www.flickr.com/photos/mrtea/1278546801/sizes/l/
http://www.flickr.com/photos/rachelrusinski/533767098/sizes/o/
http://www.cs.utk.edu/dilab/SDR_robots.jpg
http://www.mat.uc.pt/~emsa/Historia2007/Imagens/Black_Hole_Milkyway.jpg
Credits, Attribution http://commons.wikimedia.org
http://www.flickr.com/photos/missmirr/529688823/sizes/o/
Questions?
SVN exercise
http://www.projectx.co.nz/scm_session.html
SVN exercise
mkdir versionz
SVN exercise
cd versionz
SVN exercise
svnadmin create testrepo
SVN exercise
mkdir test
SVN exercise
touch test/test1.txt
touch test/text2.txt
SVN exercise
pwd
SVN exercise
svn import test file://{@}/testrepo/test -m
”initial import”
SVN exercise
svn checkout file://{@}/testrepo/test
working test
SVN exercise
cd workingtest/
SVN exercise
ls -al
SVN exercise
svn status
SVN exercise
nano test1.txt(edit)
SVN exercise
svn status
SVN exercise
svn commit -m ”Modified text1.txt”
SVN exercise
svn update
svn log
SVN exercise
nano text2.txt(edit)
SVN exercise
svn stat
SVN exercise
svn revert text2.txt
svn stat
SVN exercise
touch test3.txt
svn add test3.txt
SVN exercise
svn commit -m ”added a file”
SVN exercise
svn mv text2.txt test2.txt
svn stat
SVN exercise
svn ci -m ”renamed to test2.txt”
SVN exercise
svn log test2.txt
SVN exercise
svn diff -r1:4 test1.txt
You learnt
Create a repository Checkout and commit Check status Update and revert Adding a file Renaming and moving Examine differences