source control 101
DESCRIPTION
My brief introductory training on using source control. SubVersion was used during the presentation but it applies to most source control systems.TRANSCRIPT
![Page 1: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/1.jpg)
Pow
ered
By
ATCSource
Control 101
![Page 2: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/2.jpg)
Pow
ered
By
ATC
What are we doing?IntroductionLab 1 The file sharing way ReviewLab 2 Create repo, check in &
check out ReviewLab 3 Sync & Rollback ReviewLab 4 Conflict management Review
Lab 5 Locks & Revert ReviewLab 6 Branching ReviewLab 7 Merging ReviewAlternatives to SVNOther TortoiseSVN ToolsIDE IntegrationProven Practises
![Page 3: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/3.jpg)
Pow
ered
By
ATC
Disclaimer
The names and scenarios presented here are purely fictional. Any similarity to real people or scenarios is purely a coincidence.
No animals were harmed during the making of this bootcamp.
![Page 4: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/4.jpg)
Pow
ered
By
ATC
Time to get a little crazyYou need to be three people today
Jim, the junior software dev.Just out of his local computer school and hired by BB&D. Wrote code at school and home – by himself.
Simon, the “seasoned” software dev.Ran his own software company for a few
years - that created iPhone apps. Company size of 1.
Joined BB&D when Palm Pre killed the iPhone market.
Mike, the grizzly IT Pro. Wears shirts that say things like “There are 10 types of people, those who know binary and those who don’t.”
![Page 5: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/5.jpg)
Pow
ered
By
ATC
Supporting castThe wizard – fly’s in and does magic!(used for stuff you need, but don’t care about)
The customer, is all about giving:Gives you requirements.
Gives you headaches.Gives you money.
![Page 6: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/6.jpg)
Pow
ered
By
ATC
LAB Create a file share and do
some changes.
Time: 5min
![Page 7: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/7.jpg)
Pow
ered
By
ATC
Now...
The customer needs a bug fixed in version 1
![Page 8: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/8.jpg)
Pow
ered
By
ATC
What’s in a Name?
Revision
Control
•G
eneric term for assigning a version w
ith a change.
Source
Control
•Revision control but w
ith specific focus on source code. Branching is alm
ost unique here.
Version
Control
•M
ore general term than source control.
![Page 9: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/9.jpg)
Pow
ered
By
ATC
What is source control?An agreed way to share development
resources that gives us:
Source Control
BackupsSynchronisation
Short term undo
Long term undoTrack
changes
Track ownership
Sandboxing
Branching or merging
![Page 10: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/10.jpg)
Pow
ered
By
ATC
TerminologyRepo •Short for repository – where the files and their history are stored.
Server •The machine running one or more repo’s.
Client •The machine connecting to the repo.
Working set •The local copy of the resources you are working on.
![Page 11: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/11.jpg)
Pow
ered
By
ATC
Branching TerminologyBranch •A separate instance of code in a repository.
Trunk/Main •In a repo, this is the main or current version of code.
Merge •Act of combining branches together.
Sandbox •A branch for an individual meant for a short period of time – such as overnight.
![Page 12: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/12.jpg)
Pow
ered
By
ATC
Basic Action TerminologyAdd •Put a file into the repo for the first time.
Revision •What version the file is on.
Check Out •Download a file from the repo.
Check In •Upload a file to the repository.
![Page 13: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/13.jpg)
Pow
ered
By
ATC
Basic Action TerminologyCheck In Message •Message describing what has changed.
Changelog •A list of changes made since the file was created.
Update/Sync •Synchronise your files with latest from the repo.
Revert •Throw away your local changes
![Page 14: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/14.jpg)
Pow
ered
By
ATC
LAB Mike: Create a repo
Simon: Check in a fileJim: Get a file
Time: 5min
![Page 15: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/15.jpg)
Pow
ered
By
ATC
Lab 2 - Review
Repo
DAL.txtv1
DAL.txtv1
Add
Get
![Page 16: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/16.jpg)
Pow
ered
By
ATC
Lab 2 - Review
Is this how you should do your repo?No, use the TCP/IP or SVN protocol.
What is TortoiseSVN?The SVN client is a command line tool.TortoiseSVN is a wrapper for that.
![Page 17: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/17.jpg)
Pow
ered
By
ATC
LAB Jim: Update the file & check it
in.Simon: Sync and rollback.
Time: 5min
![Page 18: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/18.jpg)
Pow
ered
By
ATC
Lab 3 - Review
Repo
DAL.txtv2
DAL.txtv2 Update
Sync
Again
Issue RollbackDAL.txtv1
![Page 19: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/19.jpg)
Pow
ered
By
ATC
Lab 3 - Review
Why did we have to commit again?Because there was a change
What revision are we now on?Revision 3
Can we get back to the code Jim put in, if we needed to?Yes
![Page 20: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/20.jpg)
Pow
ered
By
ATC
LAB Jim: Change the file
Simon: Change the fileCONFLICT!!
Time: 10min
![Page 21: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/21.jpg)
Pow
ered
By
ATC
Lab 4 - Review
DAL.txtv3
Repo
DAL.txtv3
Sync Sync
DAL.txtv4
Update
DAL.txtv4b
Update
DAL.txtv5
Update
![Page 22: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/22.jpg)
Pow
ered
By
ATC
Lab 4 - Review
Why did we have a .r3 and .r4 file?revision 3 & revision 4
What would happen if this was the changes and we tried to commit?It would auto merge
Jim
Simon
![Page 23: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/23.jpg)
Pow
ered
By
ATC
LAB Simon: wants to do a major
code change and make sure Jim doesn’t mess with him
Time: 5min
![Page 24: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/24.jpg)
Pow
ered
By
ATC
Lock
Lab 5 - Review
DAL.txtDAL.txtv5
Repo
Sync Sync
![Page 25: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/25.jpg)
Pow
ered
By
ATC
Lab 5 - Review
Who locked the file?Developer, the user logged into Windows
What happens if the person who locked the file goes on holiday?You can break the lock if needed.
![Page 26: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/26.jpg)
Pow
ered
By
ATC
LAB Simon: As they are releasing
version 1 they want to make sure they can fix issues while working on v2.
Time: 10min
![Page 27: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/27.jpg)
Pow
ered
By
ATC
Lab 6 - Review
Repo
Trunk
Bran
ch
Trunk V1 Branch
![Page 28: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/28.jpg)
Pow
ered
By
ATC
Lab 6 - Review
Do we need to switch?No, but it helps keep focus and prevent issues across branches.
![Page 29: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/29.jpg)
Pow
ered
By
ATC
Lab 6 - Review
What is shelving?Shelving is branching to a personal temporary branch.
Why shelve?1. Interruptions: Pending changes that are not
ready for check in.2. Integration/Handoff: Sharing code with
someone else, without a check in.3. Review: Code for review4. Backup: Personal backup
![Page 30: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/30.jpg)
Pow
ered
By
ATC
Lab 6 - Review
How to shelve?Create a new root folder named shelve, as we
did for branches.In that a folder for each user.Branching as normal.
![Page 31: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/31.jpg)
Pow
ered
By
ATC
Lab 6 - Review
DEV
Bra
nch
RELEASE
Bra
nch
V1.1 (start)
V1.0Production
Release 1.01
RI
V1,0 Hotfix 1 FI R
I
V1.1
FI
DEV
Bra
nch
FI
V1.1 (start) V1.1 FT3
RI
V1.1 (bug fix)
FI
V1.1
FI
V1.2
RI
V1.2
V1.0Production
1 2
3 4 5
6 7
8
Which is correct?
![Page 32: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/32.jpg)
Pow
ered
By
ATC
Scenario #1: Single Team Branching Model
DEV
MAIN
Bra
nch
FI
V1.1 (start) V1.1 FT3
RI
V1.1 (bug fix)
FI
V1.1
FI
V1.2
RI
V1.2
CI / Nightly Builds(Early validation)
Nightly Build(Early Validation)
V1.0Production
1 2
3 4 5
6 7
8
Main should be very stable
All dev done on branch
![Page 33: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/33.jpg)
Pow
ered
By
ATC
Scenario #2: Concurrent Hot Fix, Service Pack, and v.Next
Bra
nch
DEV-1
DEV …
MAIN
R1 (SP)
RTM
Bra
nch
Bra
nch
Bra
nch
When MAIN is ready to release, create the
SERVICE PACK, HOT FIX, and RELEASE
branches at the same time.
The RTM branch is a read-only copy of
what was released
Bra
nch
Bra
nch
Bra
nch
Bra
nch
Bra
nch
SERVICE PACK
R2 (SP)
HOT FIX
R1 (SP0) R1 (SP1)
R1 (SP0) R1 (SP1)
R2 (SP0)
R2 (SP0)
FI
1
2
2
3
4
5
6
7
8
The two DEV branches are
created as sequential tasks, but as one unit of
work.
All dev done on branches
These should be read only
![Page 34: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/34.jpg)
Pow
ered
By
ATC
Scenario #3: Branching and Labeling
DEV-1
DEV …
MAIN
Bra
nch
1
2
2
V1.1
3
V1.2
4
TEST-1 5
Bra
nch
TEST … 6
Bra
nch
The two DEV branches are
created as sequential tasks, but as one unit of
work.
Release labels in branch
Main is just the latest
![Page 35: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/35.jpg)
Pow
ered
By
ATC
LAB Simon: Needs to make sure v2
gets the same bug fix as v1 had.
Time: 5min
![Page 36: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/36.jpg)
Pow
ered
By
ATC
Lab 7 - Review
Trunk
Branch v1
Mer
ge Conflict
No cartoons, cause this is too hard to show with cartoons.
![Page 37: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/37.jpg)
Pow
ered
By
ATC
Other TortoiseSVN tools
![Page 38: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/38.jpg)
Pow
ered
By
ATC
WARNING
The tools to be presented next are based on some personal use and discussion.
They could break or not work – please consultant us and test prior to adoption.
![Page 39: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/39.jpg)
Pow
ered
By
ATC
IDE Integration
http://ankhsvn.open.collab.net/Free & Open Source
http://www.pushok.com/soft_svn.phpCosts ($27) & Proprietary
& about a billion other SVN clients ;)
![Page 40: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/40.jpg)
Pow
ered
By
ATC
Alternatives to SVN
SourceSafe
Microsoft
File System Based
CVS
Previous OSS choice
TFS
Microsoft
More than source control
Enterprise
Git
Created by Linus Tourvalds
Distributed Source Control
![Page 41: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/41.jpg)
Pow
ered
By
ATC
Proven Practises
Use source control
Don’t break the build
Keep up to date
Automerge is a for sync ONLY
Don’t check in binaries
Separate repo for separate things
![Page 42: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/42.jpg)
Pow
ered
By
ATC
Proven Practises
Don’t delete from the repo
Working folders should be disposable
Use non-working folders when needed
Useful & meaningful messages
Don’t use the audit trail to assign blame
Use undo/revert sparingly
![Page 43: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/43.jpg)
Pow
ered
By
ATC
Proven Practises
Use labels but avoid label promotion
Be light and quick with checkouts
Try concurrent
Use Shelving
![Page 44: Source Control 101](https://reader033.vdocuments.mx/reader033/viewer/2022061300/54c8ff104a7959a8198b45bd/html5/thumbnails/44.jpg)
Pow
ered
By
ATC
Branching Proven Practises
Don’t be afraid of branching
Plan your branching strategy
Don’t branch UNLESS you will look after it
Take responsibility for the merge