Merge (revision control)

From Wikipedia, the free encyclopedia

Jump to: navigation, search

Merging is the act of reconciling multiple changes made to different copies of the same file. Most often, it is necessary when a file is modified by two people on two different computers at the same time. Later, these changes are merged, resulting in a single new file that contains both sets of changes.

In some cases, the merge can be performed automatically, because the changes don't conflict. In other cases, a person must decide exactly what the resulting file should contain.

Merge is most often used as a verb ("I will merge those changes"), but can also be a noun ("this merge will be difficult").

Merging is a fundamental operation of revision control, and many revision control software tools include merge capabilities.


[edit] Types of merges

There are two primary types of merges performed by automated merge tools: 2-way merge, and 3-way merge. A 3-way merge is a more powerful and reliable method of merging than is afforded by the 2-way merge.

[edit] Two-way merge

A two-way merge performs an automated difference analysis between a file 'A' and a file 'B'. This method considers the differences between the two files alone to conduct the merge and makes a "best-guess" analysis to generate the resulting merge. Consequently, this type of merge is usually the most error prone and requires user intervention to verify and sometimes correct the result of the merge prior to completing the merge event.

[edit] Three-way merge

A three-way merge is performed after an automated difference analysis between a file 'A' and a file 'B' while also considering the origin, or parent, of both files (usually the parent is the same for both). This type of merge is generally only available through the use of supporting revision control systems where such a parent would normally exist. The merge tool examines the differences and patterns appearing in the changes between both files as well as the parent, building a relationship model to generate a merge of files 'A', 'B', and the parent, 'C' to produce a new revision, 'D'.

This merge is the most reliable and has performed well in practice. It has also required the least amount of user intervention, and in many cases, requiring no intervention at all (depending upon the complexity of the merge) making the process available for task automation.

[edit] Trends

The technological advancements in the 3-way merge method have led to the increase in popularity among software development environments to institute concurrent modification through branching in their practices of Software configuration management (SCM). In the early to mid-1990's branching was a discouraged practice in smaller software development groups due to the complexities and conflicts introduced through the merging process and the low availability of cost-effective 3-way merge tools. However, this practice was more in demand among larger groups merely due to the increased likelihood that two developers would need to modify the same file at the same time. Merging, at that time, was indeed a challenge and in some environments, additional proprietary conventions were introduced to simplify the necessary merge.

In the early 2000's, the increased availability of reliable 3-way merge tools has allowed software development groups to no longer concern themselves with the technical limitations of their infrastructure, but rather focus on the complexity of the product being developed and the management capabilities of the staff. Even smaller software groups are more inclined to approach concurrent modification in their revision control systems. Nevertheless, merges still often cause problems; even intelligent merge tools can't resolve all conflicts automatically. Consequently, human interaction is required, which can lead to human errors.

[edit] Recent developments

In recent years, two new merge algorithms have been developed and are gaining popularity: the patch commutation of Darcs and the two-way merge with history of Codeville.

[edit] Standalone merging tools

Other merge tools cited in diff

[edit] See also

[edit] External links

Personal tools