140 likes | 262 Views
Intro to Version Control. Have you ever …? Had an application crash and lose ALL of your work Made changes to a file for the worse and wished you could have recovered an earlier version Saved files with dates or descriptions in their names to help track versions (e.g. report_v2_27Nov2010.doc)
E N D
Intro to Version Control • Have you ever …? • Had an application crash and lose ALL of your work • Made changes to a file for the worse and wished you could have recovered an earlier version • Saved files with dates or descriptions in their names to help track versions (e.g. report_v2_27Nov2010.doc) • Overwritten a newer version of a file by accident • Wanted to selectively integrate file changes made by others • Kept different versions of a file but were not sure what the differences were because you did not keep a log
Benefits of Source Control • Backup code outside of your working folder or even on a remote computer disaster recovery • There are internet-based source control service providers • Commit changes to file(s)/folder(s) into the repository with some descriptive text • Revert file(s)/folder(s) back to some previous state • Review changes that have been made since last commit (Diff) • For text files – something you can open and edit in Notepad(e.g. code files not Word or Excel documents) • Multiple users can access same files over a network and have their own working copy
Main concepts and workflow Repository Working copy Original folder Import / Add Checkout Edit files, add/rename files/folders, etc. Commit Edit files, add/rename files/folders, etc. Commit etc.
Create a repository • Right-click on folder (I like Repo suffix) • Do NOT add folders or files to this folder • Interact with repository with TortoiseSVN
Import / Add folder to Repository • Import • Create target folder in repository using TortoiseSVN Repo-browser • Import source folder into repository
Import / Add folder to Repository • Add • Use Repo-Browser to create base target folder (optional) • Add Folder Can create many root folders in a repository (separate folder = unique URL)
Create a Working Copy • Checkout from repository • If you are confident, delete original folder contents before checkout to that folder
Add new file/folder to Working Copy Select, right-click, Add … Select, right-click, Commit
Delete/Rename files/folders • NEVER use Explorer to delete/rename files/folders in a working copy. Use TortoiseSVN !! • Right-click file/folder and … • … and then Commit
Version control in a team • Users have local working copy that can be synchronized/compared/updated to a central repository (Update) (Update) (Commit)
Working copy details • A folder that has a _svn or .svn sub-folder contains a copy of sibling files & information about 1st level sub-folders at time of Checkout or last Update
TortoiseSVN • A GUI for Subversion integrated into Explorer Right-click in any folder …
Version control key concepts you must know • Repository(Create Repository Here in TortoiseSVN creates a SVN Repository in a folder) • A databased stored in standard named folders (e.g. conf, data). and files. Stores the data from user’s folders / files that are under version control. Accessed via client software (e.g. TortoiseSVN) • Working copy • Folder containing folders / files under version control. Each working copy folder/subfolder has a special folder (_svn or .svn) that contains a copy of sibling files & information about 1st level sub-folders at time of checkout or last update. • Import • Import folder and any folders/files it contains into repository. • Checkout • Checkout folder and any folders/files from a repository into a working copy folder (has _svn folder) • Export • Exports folder and any folders/files from a repository into a folder (not working copy, no _svn) • Commit • Commit changes in working copy folders/files to the repository • Update • Update a working copy with latest changes in the repository • Diff • Shows the differences between working copy and repository (any revision) • Revert • Reverts the content of the working copy to an earlier version (revision) in the repository • History / Log • Shows the “commit” messages for the selected working copy folder(s)/file(s) • Add • Add a new file/folder to the repository • Delete & Rename • Delete/Rename file using repository client (e.g. TortoiseSVN) NOT explorer. This will ensure folders/files are synchronized with the repository