Branching, in
version control
In software engineering, version control (also known as revision control, source control, or source code management) is a class of systems responsible for managing changes to computer programs, documents, large web sites, or other collections o ...
and
software configuration management
In software engineering, software configuration management (SCM or S/W CM) is the task of tracking and controlling changes in the software, part of the larger cross-disciplinary field of configuration management. SCM practices include revision ...
, is the duplication of an object under version control (such as a
source code
In computing, source code, or simply code, is any collection of code, with or without comments, written using a human-readable programming language, usually as plain text. The source code of a program is specially designed to facilitate the w ...
file or a
directory tree
In computing, a directory is a file system cataloging structure which contains references to other computer files, and possibly other directories. On many computers, directories are known as folders, or drawers, analogous to a workbench or the t ...
). Each object can thereafter be modified separately and in parallel so that the objects become different. In this context the objects are called branches. The users of the version control system can branch any branch.
Branches are also known as ''trees'', ''streams'' or ''codelines''. The originating branch is sometimes called the ''parent branch'', the ''upstream branch'' (or simply ''upstream'', especially if the branches are maintained by different organizations or individuals), or the ''backing stream''.
''Child branches'' are branches that have a parent; a branch without a parent is referred to as the trunk or the ''mainline''. The trunk is also sometimes loosely referred to as HEAD, but properly head refers not to a branch, but to the most recent commit on a given branch, and both the trunk and each named branch has its own head. The trunk is usually meant to be the base of a project on which development progresses. If developers are working exclusively on the trunk, it always contains the latest
cutting-edge version of the project, but therefore may also be the most unstable version. Another approach is to split a branch off the trunk, implement changes in that branch and merge the changes back into the trunk when the branch has proven to be stable and working. Depending on development mode and
commit policy the trunk may contain the most stable or the least stable or something-in-between version. Other terms for trunk include ''baseline,'' ''mainline,'' and ''master,'' though in some cases these are used with similar but distinct senses – see . Often main developer work takes place in the trunk and stable versions are branched, and occasional bug-fixes are merged from branches to the trunk. When development of future versions is done in non-trunk branches, it is usually done for projects that do not change often, or where a change is expected to take a long time to develop until it will be ready for incorporating in the trunk.
In some
distributed revision control systems, such as
Darcs, there is no distinction made between
repositories and branches; in these systems, fetching a copy of a repository is equivalent to branching.
Branching also generally implies the ability to later
merge
Merge, merging, or merger may refer to:
Concepts
* Merge (traffic), the reduction of the number of lanes on a road
* Merge (linguistics), a basic syntactic operation in generative syntax in the Minimalist Program
* Merger (politics), the comb ...
or ''integrate'' changes back onto the parent branch. Often the changes are merged back to the trunk, even if this is not the parent branch. A branch not intended to be merged (e.g. because it has been
relicensed under an incompatible license by a third party, or it attempts to serve a different purpose) is usually called a ''
fork
In cutlery or kitchenware, a fork (from la, furca 'pitchfork') is a utensil, now usually made of metal, whose long handle terminates in a head that branches into several narrow and often slightly curved tine (structural), tines with which one ...
''.
Motivations for branching
Branches allow for parts of software to be developed in parallel. Large projects require many roles to be filled, including developers, build managers, and
quality assurance personnel. Further, multiple releases on different operating system platforms may have to be maintained. Branches allow contributors to isolate changes without destabilizing the codebase, for example,
fixes for bugs, new
features, and
version
Version may refer to:
Computing
* Software version, a set of numbers that identify a unique evolution of a computer program
* VERSION (CONFIG.SYS directive), a configuration directive in FreeDOS
Music
* Cover version
* Dub version
* Remix
* ''Ve ...
s
integration. These changes may be later
merged (resynchronized) after testing.
Development branch
A ''development branch'' or ''development tree'' of a piece of software is a version that is under
development
Development or developing may refer to:
Arts
*Development hell, when a project is stuck in development
*Filmmaking, development phase, including finance and budgeting
*Development (music), the process thematic material is reshaped
* Photograph ...
, and has not yet been officially
released. In the
open source community, the notion of release is typically metaphorical, since anyone can usually check out any desired version, whether it be in the development branch or not. Often, the version that will eventually become the next ''major'' version is called ''the'' development branch. However, there is often more than one subsequent version of the software under development at a given time.
Some revision control systems have specific jargon for the main development branch. For example, in
CVS, it is called the "MAIN" branch.
Git
Git () is a distributed version control system: tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data in ...
uses "master" by default, although
GitHub
GitHub, Inc. () is an Internet hosting service for software development and version control using Git. It provides the distributed version control of Git plus access control, bug tracking, software feature requests, task management, continu ...
and
GitLab
GitLab Inc. is an open-core company that operates GitLab, a DevOps software package which can develop, secure, and operate software. The open source software project was created by Ukrainian developer Dmitriy Zaporozhets and Dutch developer ...
switched to "main"
after the murder of George Floyd. A more generic term is "trunk".
Shadow or magic branches
In
CVSNT
CVSNT is a version control system compatible with and originally based on Concurrent Versions System (CVS), but whereas that was popular in the open-source world, CVSNT included features designed for developers working on commercial software in ...
, a ''shadow'' or ''magic'' branch "shadows" changes made in the upstream branch, to make it easier to maintain small changes (cvc is an open-source package building system incorporating a revision-control system for packages produced by
rPath
rPath, Inc. was a technology company based in Raleigh, North Carolina that developed technology to automate the process of constructing (or packaging), deploying and updating software.Craig, Julie. "Cloud Coalition: rPath, newScale, and Eucalyp ...
.)
Repository clones
In
distributed revision control
In software development, distributed version control (also known as distributed revision control) is a form of version control in which the complete codebase, including its full history, is mirrored on every developer's computer. Compared to centr ...
, the entire repository, with branches, may be copied and worked on further.
Monotone
Monotone refers to a sound, for example music or speech, that has a single unvaried tone. See: monophony.
Monotone or monotonicity may also refer to:
In economics
*Monotone preferences, a property of a consumer's preference ordering.
*Monotonic ...
(mtn),
Mercurial
Mercurial is a distributed revision control tool for software developers. It is supported on Microsoft Windows and Unix-like systems, such as FreeBSD, macOS, and Linux.
Mercurial's major design goals include high performance and scalability, d ...
(hg) and
git
Git () is a distributed version control system: tracking changes in any set of files, usually used for coordinating work among programmers collaboratively developing source code during software development. Its goals include speed, data in ...
call it "clone";
Bazaar calls it "branch".
See also
*
Revision tag A revision tag is a textual label that can be associated with a specific revision of a project maintained by a version control system. This allows the user to define a meaningful name to be given to a particular state of a project that is under vers ...
References
{{DEFAULTSORT:Branching (version control)
Version control