Introduction to Source Control

From Valve Developer Community
Jump to: navigation, search

Source control refers to a management system that helps control how information changes. For example, a source control system might be used in a software project to help mitigate some of the hazards of having developers work in parallel or to provide easy roll-back and branching functionality (for when development decides to go in another direction).


The remainder of this article gives a brief introduction to source control and talks a little about the Source SDK relevant issues.


Overview

A software source control system will typically manage a collection of files and directories, which we will call items. It often associates such a collection with something called a repository. You can think of a repository as something like a warehouse where all your code is "bagged-and-tagged".


As a user makes changes, such as adding, removing, and modifying items, the system will monitor the changes and provide this information in a status report. When a user is satisfied with the changes they have made and with the status, they can commit their changes to the repository. A user will typically provide a short description of the collection of changes that they are committing during the commit process. These messages, along with their corresponding revision numbers, can be viewed in the repository's log.


Revision numbers provide an easy way to refer to the repository at an earlier point in time. The repository can be restored to an earlier revision, called a roll-back. A separate path of development can be created in the same repository at a given revision, called a branch. Branches can be consolidated together or with a central development trunk by merging them. A repository can be copied and made independent up to a given revision, called a fork. Also, differences in files can be inspected by referencing revision numbers.

Technology

Common systems today operate in a client-server or peer-to-peer way. These systems typically provide networked functionality. Many may also be operated offline and/or in a completely local capacity. Local only solutions do exist, though the core technology is typically older. For more detail, see wikipedia.


Source SDK

Valve will periodically update the Source SDK code base. This may or may not introduce conflicts with mod projects that have already modified code that was updated. Source control doesn't make these conflicts magically disappear, but they do provide a powerful way to deal with these issues in a safe and controlled manner.


It is strongly recommended and encouraged that mod developers use source control in their projects.


Valve uses Perforce as their source control solution. Other common solutions are Git, Hg (Mercurial), and SVN (Subversion), just to name a few. The following are more detailed articles on using a particular source control technology to manage a Source SDK project.


Getting Started

See also