- Merge (revision control)
-
Merging (also called integration) in revision control, is a fundamental operation that reconciles multiple changes made to a revision-controlled collection of files. Most often, it is necessary when a file is modified by two people on two different computers at the same time. When two branches are merged, the result is a single collection of files that contains both sets of changes.
In some cases, the merge can be performed automatically, because the changes do not conflict. In other cases, a person must decide exactly what the resulting files should contain. Many revision control software tools include merge capabilities.
Merge can be used as a verb ("to merge branches,") but can also be a noun ("this merge will be difficult.")
Contents
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.
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.
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 more likely to be usable in revision control systems, which can guarantee that such a parent exists and is known. 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 eligible for task automation.
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-1990s 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 2000s, the increased availability of reliable 3-way merge tools reduced the time that software development groups had to spend concerning themselves with the technical limitations of their infrastructure. 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.
3-way merges still remain one of the more taxing tasks of any software development team. This is especially because the person resolving the merge needs prior knowledge of the original code, the intermediate commit and the changes wanted.
Recent developments
In recent years, some new merge algorithms have been developed and are gaining popularity:
Standalone merging tools
- Araxis Merge 2/3-way file comparison, merging and folder synchronization for Windows and Mac OS X (http://www.araxis.com/)
- Beyond Compare Professional Folder and file comparison/synchronization and 3-way merge utility for Windows and Linux (http://www.scootersoftware.com/)
- Compare++ Smart code diff utility for Windows, can do structured comparison and merge for C/C++, Java, C#, Javascript, CSS, ...(http://www.coodesoft.com/)
- DeltaWalker Oro Two and three-way file & folder comparison, merge and synchronization for Mac OS X, Windows, and Linux (http://www.deltopia.com/)
- DiffMerge (http://www.sourcegear.com/diffmerge/index.html) file and folder compare and merge (also supports three way merge) for Mac OS X, Windows and Linux.
- ECMerge 2-way and 3-way diff/merge tool for text, images and directories (http://www.elliecomputing.com)
- ExamDiff_Pro compare directories, binary files and text files (http://www.prestosoft.com/edp_examdiffpro.asp)
- Apple FileMerge, a Mac OS X development tool derived from Merge from NeXT
- Guiffy SureMerge File Compare, Folder Compare, and Merge tool (http://www.guiffy.com)
- diff3 3-way merge tool, widely spread on Unix-like systems
- KDiff3 3-way merge tool (http://kdiff3.sourceforge.net)
- medini unite 3-way diff and merge tool for Matlab Simulink and Stateflow models (http://www.ikv.de)
- meld
- MergePlant 3-way merge tool (http://www.mikado-ltd.com)
- SimMerge 3-way merge tool for Simulink models. (http://www.ensoftcorp.com/SimMerge/)
- tkmerge
- WinMerge a free, open source graphic windows based diff and merge tool
- UltraCompare (http://www.ultraedit.com/products/ultracompare.html)
- xxdiff - Graphical File And Directories Comparator And Merge Tool
Other merge tools are cited in diff.
See also
External links
- Simple way to understand 3-Way merge process
- The new Codeville merge algorithm Explanation of the Codeville merge algorithm by Bram Cohen
- Review of several popular Merge tools from various manufacturers
Revision control software Years, where available, indicate the date of first stable release. Systems with names in italics are no longer maintained or have planned end-of-life dates.Local only - PVCS (1985)
Client-server Free/open-source- CVS (1990)
- CVSNT (1998)
- Subversion (2004)
Proprietary- Software Change Manager (1970s)
- ClearCase (1992)
- CMVC (1994)
- Visual SourceSafe (1994)
- Perforce (1995)
- StarTeam (1995)
- MKS Integrity (2001)
- AccuRev SCM (2002)
- SourceAnywhere (2003)
- Vault (2003)
- Team Foundation Server (2005)
- Rational Team Concert (2008)
Distributed Free/open-sourceProprietary- TeamWare (1990s?)
- Code Co-op (1997)
- BitKeeper (1998)
- Plastic SCM (2006)
Concepts - Category
- Comparison
- List
Categories:
Wikimedia Foundation. 2010.