Branch per Task

Synopsis::A new branch is created for each task assigned from the main codeline. These task branches are closed and merged back into the codeline on completion.

Intent
Changes in a particular codeline may overlap (modify the some of the same files). This overlap can cause instability and problems with preparing builds. The task per branch pattern isolates these potentially overlapping change tasks on their own branch, stabilising the environment for each task.

Motivation
Multiple developers working on the same codeline may destabilise one another's change environment.

Each change to the codeline potentially destabilises the codeline for all other developers. A mistake by one developer when committing to the codeline may result in lost time and effort for all other users of the codeline.

Applicability
Task per branch is widely applicable to many software development efforts.

Also known as
also known as::Activity Branching, also known as::Task Branching, also known as::Side Branching, also known as::Transient Branching

Structure
A branch is made for each change task on a codeline. These task branches are merged back into the codeline once the change task they support is complete (coded and tested).



Participants
Task branches may be created by a central authority and assigned to developers for use, or they may be created by individual developers as needed.

Task branches may be merged back to the codeline by individual developers (MYOC) or the merge may be the responsibility of a central agent assigned by the codeline owner.

Collaborations
Testers may need to be notified of task branches if external test validation is required before merging task branches back into the source codeline.

Consequences

 * Modifications made on the task branch are isolated from the codeline and from one another.
 * Isolating changes this way ensures stability on the task branch, but at the cost of increasing the merge burden.
 * Keeping task branches open for too long can make the cost of merge so high that the benefits of isolation are outweighed.
 * Care must be taken when integrating task branches back into the codeline; changes that worked in the isolation of the task branch may not work when directly merged into the codeline.

Known uses
Task per branch is a common pattern used throughout software development. Public examples include.

Related patterns
The following patterns are variants of the pattern.
 * variant pattern::Branch per Major Task
 * variant pattern::Branch per Change Request
 * variant pattern::Personal Activity Branch

The following patterns are related to the pattern.
 * related pattern::Codeline Policy
 * related pattern::Codeline Ownership
 * related pattern::Merge Your Own Code
 * related pattern::Subproject Line