Download - Using Source Control effectively
![Page 1: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/1.jpg)
![Page 2: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/2.jpg)
22
Using Source Control effectivelyNothing is ever “gone forever”
Hoa Hoang
![Page 3: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/3.jpg)
33
AgendaAgenda
Problems
Version Control System
Subversion - Tortoise SVN
7 habits of using SVN
Best Practices
Q & A
![Page 4: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/4.jpg)
44
ProblemsProblems
Users editing the same file concurrently overwriting each otherUsers editing the same file concurrently overwriting each other
![Page 5: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/5.jpg)
55
ProblemsProblems
Many copy of source code on file server and local machineMany copy of source code on file server and local machine
![Page 6: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/6.jpg)
66
ProblemsProblems
index.aspx
Accident of deletion, overwritingAccident of deletion, overwritingData lost forever
Unknown who, how, what, why, when, where files changed
![Page 7: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/7.jpg)
77
ProblemsProblems
Problem & more…Problem & more…
![Page 8: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/8.jpg)
88
AgendaAgenda
Problems
Version Control System
Subversion -Tortoise SVN
7 habits of using SVN
Best Practices
Q & A
![Page 9: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/9.jpg)
99
Version control systemVersion control system
VCS is crucial to engineering and software development projectsVCS is crucial to engineering and software development projectso Repositoryo Team-based collaboration o Record changeso Revision o Historyo Trunko Branches / Tag
![Page 10: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/10.jpg)
1010
Version control systemVersion control system
Version control server
Repository
Client
Client
Client
Working copy
Working copy
Working copy
Working copy
Client
RepositoryRepositoryCentralized stores of data. In SVN, data stored in the form of a filesystem tree
by a hierarchy of files and directories
![Page 11: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/11.jpg)
1111
Version control systemVersion control system
Working copyWorking copyo A ordinary directory tree of source
code for projects checkout to your local hard drive. Were you can freely make changes => Creating revision
![Page 12: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/12.jpg)
1212
Version control systemVersion control system
Team-based collaborationTeam-based collaboration
![Page 13: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/13.jpg)
1313
Version control systemVersion control system
Team-based collaborationTeam-based collaboration
![Page 14: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/14.jpg)
1414
Version control systemVersion control system
RevisionRevisionA version number associated with a chain of changes to the contents of a
single or multiple Files/Directories in the Repository
![Page 15: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/15.jpg)
1515
4
A
B’
C
D
E
F
3
A
B’
C
D
1
A
B
C
0 2
A
B’
C
Version control systemVersion control system
revision 473
Index.html
revision 415revision 430
revision 472
revision 477
RevisionRevision
![Page 16: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/16.jpg)
1616
Version control systemVersion control system
Record changesRecord changeswho, what, why, when, where files changed
![Page 17: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/17.jpg)
1717
Version control systemVersion control system
HistoryHistory
![Page 18: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/18.jpg)
1818
Version control systemVersion control system
ProjectProjectProject = directory
Grouping of files/directories contained within repository
Usually multiple Projects per Repository
Project usually created as a named directory with the following structure
projectbranchestagstrunk
![Page 19: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/19.jpg)
1919
Version control systemVersion control system
TrunkTrunk
trunk
342
347
421
425 434
branch maintenance
branch
tag
release
merge
426
![Page 20: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/20.jpg)
2020
Version control systemVersion control system
BranchsBranchsA second copy of your document directory (project), maintaining separately
and worked in parallel to the main codeline (Trunk)
![Page 21: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/21.jpg)
2121
Version control systemVersion control system
TagTagA labeled snapshot of the directory (project) in time, or a Branch, at a
particular Revision.
![Page 22: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/22.jpg)
2222
![Page 23: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/23.jpg)
2323
VCS Work-cycleVCS Work-cycle
Check outCheck outTo retrieve a directory from the Repository to view and/or edit the Resource. Allow to choose resource at a specific point
o Head: Most recent revisiono Revision#: most recent a
specific revision numbero Tag: A revision# marked as tag
(Release) o Date: Specific date
Check Out
Yes
Start
Modify
Update
Commit
Merge
Delete Revert
Conflict
NoBranch
Tag
End
Mark resolved
Rename
Clean up
Add
![Page 24: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/24.jpg)
2424
Check Out
Yes
Start
Modify
Update
Commit
Merge
Delete Revert
Conflict
NoBranch
Tag
End
Mark resolved
Rename
Clean up
ModifyModifyModify: Doing your work on working
copy
Lock file no nobody else can edit.
Unlock when done
VCS Work-cycleVCS Work-cycle
Add
![Page 25: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/25.jpg)
2525
Check Out
Yes
Start
Modify
Update
Commit
Merge
Delete Revert
Conflict
NoBranch
Tag
End
Mark resolved
Rename
Clean up
VCS Work-cycleVCS Work-cycle
RevertRevertWhen your changes become messy, want to get the good copy from repository overwrite back to working copy
Add
![Page 26: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/26.jpg)
2626
Check Out
Yes
Start
Modify
Update
Commit
Merge
Delete Revert
Conflict
NoBranch
Tag
End
Mark resolved
Rename
Clean up
VCS Work-cycleVCS Work-cycle
CleanupCleanup
RenameRename
DeleteDelete
AddAdd
Add
![Page 27: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/27.jpg)
2727
Check Out
Yes
Start
Modify
Update
Commit
Merge
Delete Revert
Conflict
NoBranch
Tag
End
Mark resolved
Rename
Clean up
VCS Work-cycleVCS Work-cycle
UpdateUpdateDownloading and merging all latest changes from repository into your working copy – (prevent conflict)
Add
![Page 28: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/28.jpg)
2828
Check Out
Yes
Start
Modify
Update
Commit
Merge
Delete Revert
Conflict
NoBranch
Tag
End
Mark resolved
Rename
Clean up
VCS Work-cycleVCS Work-cycle
ConflictConflictResolve conflict: Chose/modify if there some lines editing both by theirs and mine
Add
![Page 29: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/29.jpg)
2929
Check Out
Yes
Start
Modify
Update
Commit
Merge
Delete Revert
Conflict
NoBranch
Tag
End
Mark resolved
Rename
Clean up
VCS Work-cycleVCS Work-cycle
Merge/DifferentMerge/DifferentMerge: Often automatically done by subversion. If theirs code and mine code change on different line
Add
![Page 30: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/30.jpg)
3030
VCS Work-cycleVCS Work-cycle
CommitCommitCheck in/Commit: pushing edited files to repository (with a log message saying what you did)
Check Out
Yes
Start
Modify
Update
Commit
Merge
Delete Revert
Conflict
NoBranch
Tag
End
Mark resolved
Rename
Clean up
Add
![Page 31: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/31.jpg)
3131
VCS Work-cycleVCS Work-cycle
BranchesBranches
TagsTags
ImportImport
ExportExport
Check Out
Yes
Start
Modify
Update
Commit
Merge
Delete Revert
Conflict
NoBranch
Tag
End
Mark resolved
Rename
Clean up
Add
![Page 32: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/32.jpg)
3232
Revision control softwareRevision control software
SubversionSubversion
Visual SourceSafeVisual SourceSafe
StarTeamStarTeam
CVS CVS
AccuRev AccuRev
……http://en.wikipedia.org/wiki/List_of_revision_control_softwarehttp://en.wikipedia.org/wiki/List_of_revision_control_software
![Page 33: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/33.jpg)
3333
AgendaAgenda
Problems
Version Control System
Subversion Tortoise SVN
7 habits of using SVN
Best Practices
Q & A
![Page 34: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/34.jpg)
3434
SubversionSubversion
A version control system, it handles any types of files, A version control system, it handles any types of files, documents, or directories with these featuresdocuments, or directories with these featureso Atomic Commitso Windows-integrated (Tortoise SVN)o Directory base (not project-base)o Import directory (Project)o 2 versioning modelso Copy-Modify-Merge o Lock-Modify-Unlock o Renaming revisiono Branch/Tag/Merge/Different
![Page 35: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/35.jpg)
3535
SubversionSubversion
BenefitBenefito Better binary file supporto File/directory renamingo Metadata versioningo Better bandwidth usageo Multiple protocal (svn://, http://)o Efficient branching and taggingo Many client tool & add-in support Eclipse, AnkSVN, InterliJ Idea, Visual
Studio…Tortoise SVNo Ignoringo Revert/Cleanupo Comparing/Different
![Page 36: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/36.jpg)
3636
SubversionSubversion
Repository ViewRepository Viewo Connecting to repositoryo Browsingo Making revision linko Checking out
Synchronize ViewSynchronize Viewo Updatingo Committingo Revertingo Conflict resolution
History ViewHistory Viewo Reviewing changes
![Page 37: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/37.jpg)
3737
SubversionSubversion
Apache base serverApache base servero http://linuxtwo:8080/repository/ABCProject
SVN base serverSVN base servero svn://linuxtwo/repository/ABCProject
File system base serverFile system base servero file:///D:/repository/ABCProject
![Page 38: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/38.jpg)
3838
Tortoise SVNTortoise SVN
Status of version controlled files/foldersStatus of version controlled files/foldersGreen checkmark: normal status, under control
Red exclamation: file has been modified since last update and needs to be committed.
Yellow exclamation: a conflict occurs during an update.
Grey checkmark: this file needs to be locked first before editing.
Locked lock: file is locked. Need to unlock for other to commit.
Red deletion: missing file or file to be deleted under version control.
Blue plus: File to be added to version control.
![Page 39: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/39.jpg)
3939
DemoDemo
![Page 40: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/40.jpg)
4040
AgendaAgenda
Problems
Version Control System
Subversion - Tortoise SVN
7 habits of using SVN
Best Practices
Q & A
![Page 41: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/41.jpg)
4141
7 habits of using SVN7 habits of using SVN
11Update/Commit source code every good changesUpdate/Commit source code every good changes
Give comments for the commitGive comments for the commit
![Page 42: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/42.jpg)
4242
7 habits of using SVN7 habits of using SVN
22Update/Merge/Resolve conflict before CommitUpdate/Merge/Resolve conflict before Commit
![Page 43: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/43.jpg)
4343
7 habits of using SVN7 habits of using SVN
33 Do not shy, do not stupid, do not blame when conflict. Quickly find Do not shy, do not stupid, do not blame when conflict. Quickly find
‘theirs’ and resolve together‘theirs’ and resolve together
![Page 44: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/44.jpg)
4444
7 habits of using SVN7 habits of using SVN
44Use TortoiseSVN commands (delete, rename, copy) Do not use the Use TortoiseSVN commands (delete, rename, copy) Do not use the
Windows Explorer commands.Windows Explorer commands.
Donot changes or remove the added svn files/foldersDonot changes or remove the added svn files/folders
![Page 45: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/45.jpg)
4545
7 habits of using SVN7 habits of using SVN
55Delete your working copy and checkout new source every MondayDelete your working copy and checkout new source every Monday
![Page 46: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/46.jpg)
4646
7 habits of using SVN7 habits of using SVN
66Don’t versioning by yourself Don’t versioning by yourself
![Page 47: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/47.jpg)
4747
7 habits of using SVN7 habits of using SVN
77Use revert and cleanup when thing are messyUse revert and cleanup when thing are messy
Make ignore garbage files/directories before commitMake ignore garbage files/directories before commit
![Page 48: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/48.jpg)
4848
AgendaAgenda
Problems
Version Control System
Subversion - Tortoise SVN
7 habits of using SVN
Best Practices
Q & A
![Page 49: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/49.jpg)
4949
Best PracticesBest Practices
Commit Often!Commit Often!The less time you spend with code you haven't committed, the less likely
someone will edit a line you’ve not committed.
Commit in small chunks!Commit in small chunks!The less code you change and don’t commit, the less likely someone will edit
a line you’ve not committed.
Split your project into more than one file!Split your project into more than one file!You should be doing this anyways ?
Avoiding ConflictsAvoiding Conflicts
![Page 50: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/50.jpg)
5050
Best PracticesBest Practices
Don’t commit broken codeDon’t commit broken codeIf someone else updates, they will have broken code too and will be unable to work
unless they fix your mess
Don’t commit temporary/binary filesDon’t commit temporary/binary filesWe don’t need files like vore.vcproj.SNOWFIRE.philipd.user or any .exe or .obj files.
They waste space!You MAY commit graphics as long as they aren’t too big.Binary files don’t get merged.
Don’t commit ginourmous filesDon’t commit ginourmous filesRemember, if you put it in the repository you force people to download it!A good alternative for optional files that are big is to put them on a web server –
particularly if they don’t change
What not to do…What not to do…
![Page 51: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/51.jpg)
5151
Best PracticesBest Practices
When you commit, describe in the log as succinctly and clearly When you commit, describe in the log as succinctly and clearly what you changed as possiblewhat you changed as possibleThis information will help others know what you did to the code
Add your new filesAdd your new filesIf you make a new file, make sure to right click and add it to source control. If
you don’t, others won’t be able to get it.
EXAMPLE: In a game, you add a bitmap file. If you forget to add it to the subversion, when others synchronize, they download your code but not the bitmap. Now when they run the game, it crashes because it can’t find your file.
What to do..What to do..
![Page 52: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/52.jpg)
5252
AgendaAgenda
Problems
Version Control System
Subversion - Tortoise SVN
7 habits of using SVN
Best Practices
Q & A
![Page 53: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/53.jpg)
5353
Q & AQ & A
How to obtain a “clean” working copy (original sources only) and How to obtain a “clean” working copy (original sources only) and exclude .svn folders. exclude .svn folders. Select working copy>right-click>TortoiseSVN>ExportProvide the destination folder for the “clean” working copy
How to leave (ignore) the files/folders not in source controlHow to leave (ignore) the files/folders not in source controlSelect files/folders in working copy not in source controlRight-click>TortoiseSVN>Add to ignore list
How to add “free” files/folders (in working copy) into source How to add “free” files/folders (in working copy) into source controlcontrolSelect fils/folders>right-click>TortoiseSVN>AddCommit the working copy
![Page 54: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/54.jpg)
5454
Q & AQ & A
How to break/steal lockHow to break/steal lockThis is to break the locking on file by override the locking author.
Check for modifications>select locked files>break lock, OR
Right click>TortoiseSVN>Get lock, check the Steal option, OK.
Recommend: should not use this function unless you have agreement of the PM.
Cannot login because of wrong SSL cache: clear cacheCannot login because of wrong SSL cache: clear cacheFirst login to a wrong/forbidden link failed => wrong SSL is cached
Later login (to correct link) also failed because the TortoiseSVN use the wrong cached SSL.
Solution: right click>TortoiseSVN>Settings>Saved data>Authentication Data>Clear
![Page 55: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/55.jpg)
5555
Q & AQ & A
How to check out an SVN directory (recursively) to local existing How to check out an SVN directory (recursively) to local existing folder? (Similar to get latest version in VSS & overwrite all local)folder? (Similar to get latest version in VSS & overwrite all local)Should checkout to an empty working copy.Existing working copy may cause file conflict or leave files not under source
control.
How to get specific version of code from SVN? How to get specific version of code from SVN? Select file/folder in the working copyTortoiseSVN>Update to revision…Select the option Revision, input desired revisionYou can Show log to know the log message.
![Page 56: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/56.jpg)
5656
More question?More question?
![Page 57: Using Source Control effectively](https://reader035.vdocuments.us/reader035/viewer/2022062518/568142bd550346895daf01fb/html5/thumbnails/57.jpg)
5757
Thank you !!!