18
Source Control Basics Kateryna Sasnyk September, 2014

Source Control Basics

  • Upload
    kate

  • View
    7

  • Download
    0

Embed Size (px)

DESCRIPTION

Source Control Basics

Citation preview

Page 1: Source Control Basics

Source Control Basics

Kateryna SasnykSeptember, 2014

Page 2: Source Control Basics

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)

Page 3: Source Control Basics

Models of source control (1)

• Local-only approach

All developers must use the same file system.

Page 4: Source Control Basics

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.

Page 5: Source Control Basics

Models of source control (3)

• Client-server model

Developers use a shared single repository located on the server.

Page 6: Source Control Basics

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.

Page 7: Source Control Basics

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.

Page 8: Source Control Basics

Basic terminology: repository

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

Page 9: Source Control Basics

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.

Page 10: Source Control Basics

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.

Page 11: Source Control Basics

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.

Page 12: Source Control Basics

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.

Page 13: Source Control Basics

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.

Page 14: Source Control Basics

Basic terminology: history

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

Page 15: Source Control Basics

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

Page 16: Source Control Basics

Quiz: guess source control model

Page 17: Source Control Basics

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/

Page 18: Source Control Basics