Source Control Basics

Post on 13-Apr-2016

9 views 0 download

description

Source Control Basics

transcript

Source Control Basics

Kateryna SasnykSeptember, 2014

What is source control?

Managing changes to information (documents, software code, websites, etc.)

Optional names:

• Revision Control

• Version Control

• SCM (software configuration/source code management)

Models of source control (1)

• Local-only approach

All developers must use the same file system.

Models of source control (2)

• Distributed model

Developers make synchronization by exchanging patches (sets of changes) between their local repositories without any predefined central repository.

Models of source control (3)

• Client-server model

Developers use a shared single repository located on the server.

Source control tools: main features

Regardless of which source control tool you use, it is likely that it provides some or all of the following basic features:

• It provides a place to store your source code.

• It provides a historical record of what you have done over time.

• It can provide a way for developers to work on separate tasks in parallel, merging their efforts later.

• It can provide a way for developers to work together without getting in each others' way.

Source control software

• Local-only: PVCS, QVCS, RCS, SCCS

• Distributed: Monotone, Codeville, Bazaar, Git, Mercurial, etc.

• Client-server: CVS, Subversion, TFS, ClearCase, VSS, Perforce, Adobe RoboHelp Server, etc.

Basic terminology: repository

• Repository is a central place where data is stored and maintained.

Basic terminology: working copy

• Working copy (working folder) is the copy of files from a repository. This is your local “sandbox” where your work on the versioned files. Normally, it resides on your local hard disk.

Basic terminology: update

• Update – to receive all the changes from the repository (made by other people, for example) into the local folder.

All the files in our working folder which have been changed and committed to the repository will be updated with their newer versions.

Basic terminology: add, commit

• Add – to specify files or folders on your desktop machine which will be added to the working copy.

• Commit (checkin, ci) – to send local changes from the working copy to the repository.

Basic terminology: lock/unlock

• Lock – to prevent other people from modifying the file that you are working on.

• Revert – to undo all of your changes to the file taken from the repository.

File locking: pro and contra

File locking has both merits and drawbacks.

• It can provide some protection against difficult merge conflicts.

However, if the files are left locked for too long, other employees may be tempted to bypass the revision control software and change the files locally, leading to more serious problems.

Basic terminology: history

• History – to show the history of changes to a file or directory within the repository.

Basic terminology: conflict

Conflicts arise if:• Several people have simultaneously edited the

same file, and then try to commit their changes.• You have changed the local copy of the file that is

not current on the repository.

Ways out:• Revert your changes, update your local copy with

the latest changes from the repository, and then reapply your changes.

• Override changes on the repository with your changes

Quiz: guess source control model

Further readings

• Visual Guide to Version Control at: http://betterexplained.com/articles/a-visual-guide-to-version-control/

• Source Control HOWTO by Eric Sink at: http://www.ericsink.com/scm/source_control.html

• Article about Version Control Systems at: http://www.smashingmagazine.com/2008/09/18/the-top-7-open-source-version-control-systems/