HOME

TheInfoList



OR:

Branching, in
version control Version control (also known as revision control, source control, and source code management) is the software engineering practice of controlling, organizing, and tracking different versions in history of computer files; primarily source code t ...
and software configuration management, is the duplication of an object under version control (such as a
source code In computing, source code, or simply code or source, is a plain text computer program written in a programming language. A programmer writes the human readable source code to control the behavior of a computer. Since a computer, at base, only ...
file or a directory tree). 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''.


Trunk

''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 (so called trunk-based development), 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.


Merging

Branching generally implies the ability to later merge 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''.


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 versions integration. These changes may be later merged (resynchronized) after testing. Branches can also be used to implement vendor branching, a strategy to use, track and optionally modify source code that is published by external "upstream" parties ("vendors"). With this approach, fairly common since the CVS times, a separate branch is created to keep the vendor-provided code. This branch is updated with new upstream releases and merged into the main codebase when necessary.


Development branch

A ''development branch'' or ''development tree'' of a piece of software is a version that is under development, and has not yet been officially released. In the
open source Open source is source code that is made freely available for possible modification and redistribution. Products include permission to use and view the source code, design documents, or content of the product. The open source model is a decentrali ...
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. Often, the development branch is the trunk. Some revision control systems have specific jargon for the main development branch. For example, in CVS, it is called the "MAIN" branch. Git uses "master" by default, although
GitHub GitHub () is a Proprietary software, proprietary developer platform that allows developers to create, store, manage, and share their code. It uses Git to provide distributed version control and GitHub itself provides access control, bug trackin ...
and
GitLab GitLab is a software forge primarily developed by GitLab Inc. It is available as a community edition and a commercial edition. History GitLab was created in 2011 by Ukrainian programmer Dmitriy Zaporozhets as a side project written in Rub ...
switched to "main" after the murder of George Floyd.


Shadow or magic branches

In CVSNT, 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.)


Distributed revision control


Repository clones

In distributed revision control, the entire repository, with branches, may be copied and worked on further. Monotone (mtn), Mercurial (hg) and git call it "clone";
Bazaar A bazaar or souk is a marketplace consisting of multiple small Market stall, stalls or shops, especially in the Middle East, the Balkans, Central Asia, North Africa and South Asia. They are traditionally located in vaulted or covered streets th ...
calls it "branch". 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.


See also

*
Revision tag Revision is the process of modifying and the resulting artifact. More specifically, it may refer to: * Patch (computing), a relatively small modification to a computing resource such as software or file, ''revision'' (a.k.a. update) refers to an ...


References

{{DEFAULTSORT:Branching (version control) Version control