A version control primer

A version control system maintains an organized set of all the versions of files that are made over time. Version control systems allow people to go back to previous versions, and to compare any two versions to see what changes were made between them. In this way, version control keeps a historically accurate (and retrievable!) log of a file's evolution. More importantly, version control systems help several people (even in geographically disparate locations) work together on a development project over the Internet or private network to make changes to the same file over time.

Key concepts in version control:

Repository:
  a shared database the the complete version history of all files under version control.

Workspace:
  a copy of the files you want to edit on your local hard disk or Unix user account. When you edit files in your workspace, they will become out of sync with the repository. That's progress! Then you need to get your changes back into the repository so that everyone else can see them.

Checking out a file or directory:
  this copies a version (usually the latest version) of a file from the repository to your workspace. When you check out a directory, you check out all files and subdirectories under it.

Checking in a file or directory:
  this copies your working directory back into the repository as a new version.

Committing a file or directory:
  is the same as checking it in. Often version control users will say that the have "committed a change"; this means that they made changes and committed these back to the repository.

Version:
  a numbered draft of a file, e.g., 1.1, 1.2, 1.3, 1.4, 2.0, 2.1. Each time you edit a file and commit it back to the repository, its version number increases. You can change the first digit of the number any time you like.

Conflict:
  When two people make changes to the same file at the same time, their work may conflict. There are two ways to address conflicts: locks and merging.

Locks:
  one strategy for managing conflicts in version control is to lock files so that only one person can check out a read-write copy at a time. Other users can only get read-only copies. This prevents two people from ever working on the same file at the same time. It is safe, but not very efficient in practice. Also, if one person locks a file and then leaves for the day or the week, no one else can work with that file, so they are needlessly blocked.

Merging:
  another strategy for managing conflict is to let multiple people work at the same time (with no locks) and then try to merge their results into one combined version. This is closer to the way that intelligent people tend to work together in parallel if they had no version control tools. Merging works well when two sets of changes can be combined, and poorly when it is impossible to combine changes. CVS uses merging.

More information: CVS for New Users (an article)

Back to main Help index