Merge (revision control)
Encyclopedia
Merging in revision control
Revision control
Revision control, also known as version control and source control , is the management of changes to documents, programs, and other information stored as computer files. It is most commonly used in software development, where a team of people may change the same files...

, 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
Branching (software)
Branching, in revision control and software configuration management, is the duplication of an object under revision control so that modifications can happen in parallel along both 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.")

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
Software configuration management
In software engineering, software configuration management is the task of tracking and controlling changes in the software. Configuration management practices include revision control and the establishment of baselines....

 (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:
  • the patch commutation of Darcs
    Darcs
    Darcs is a distributed revision control system created by David Roundy; it was designed to replace traditional, centralized source control systems such as CVS and Subversion...

  • the two-way merge with history of Codeville
    Codeville
    Codeville is a distributed revision control system. It was written by Ross Cohen using Python, with some design work done by Bram Cohen. It uses an innovative merging algorithm called the "Codeville merge". A new merge algorithm called "Precise Codeville" or "pcvd" merge was under development...


Standalone merging tools

  • Araxis Merge
    Araxis Merge
    Araxis Merge is a two and three-way visual file comparison , merging and folder synchronization application for Windows and Mac OS X, created by Araxis Ltd...

     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++
    Compare++
    Compare++ is a useful auxiliary tool for programmers and Web developers. The tool can compare text files and folders quickly. It is useful to detect differences of codes and match. In the review of Softsea in the June 2, 2010, Compare++ was awarded 5 Stars Rating...

     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
    ExamDiff Pro
    ExamDiff Pro is a software utility for visual file comparison and directory comparison. ExamDiff Pro runs on Microsoft Windows.ExamDiff Pro features a double-pane view that allows for side-by-side comparisons, with color-coded line numbers indicating whether each line is added, deleted, or changed...

     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
    Guiffy SureMerge
    Guiffy SureMerge is a cross-platform File compare Diff tool, Folder compare, and 3-way auto-merge tool all-in-one. Guiffy SureMerge is available on Windows, Mac OS X, Linux, and Unix operating systems.-Features:* Automatic trustworthy 3-way file merge...

     File Compare, Folder Compare, and Merge tool (http://www.guiffy.com)
  • diff3
    Diff3
    diff3 is a Unix utility to compare three files and show any differences among them. diff3 can also merge files,implementing the so called three-way merge.-Merging from a common ancestor:...

     3-way merge tool, widely spread on Unix
    Unix
    Unix is a multitasking, multi-user computer operating system originally developed in 1969 by a group of AT&T employees at Bell Labs, including Ken Thompson, Dennis Ritchie, Brian Kernighan, Douglas McIlroy, and Joe Ossanna...

    -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
    Meld (software)
    Meld is a free computer program for Linux and other Unix-like platforms, for viewing and merging differences between files in a graphical environment. It allows users to view a diff of two or three files visually, color coding the different lines...

  • MergePlant 3-way merge tool (http://www.mikado-ltd.com)
  • SimMerge 3-way merge tool for Simulink
    Simulink
    Simulink, developed by MathWorks, is a commercial tool for modeling, simulating and analyzing multidomain dynamic systems. Its primary interface is a graphical block diagramming tool and a customizable set of block libraries. It offers tight integration with the rest of the MATLAB environment and...

     models. (http://www.ensoftcorp.com/SimMerge/)
  • tkmerge
  • WinMerge
    WinMerge
    WinMerge is a free software tool for file comparison and merging text-like files. It is useful for determining what has changed between versions, and then merging changes between versions.The project is currently dormant.WinMerge runs on Microsoft Windows....

     a free, open source graphic windows based diff and merge tool
  • UltraCompare
    UltraEdit
    UltraEdit is a commercial text editor for Microsoft Windows, Linux and created in 1994 by Ian D. Mead. The editor contains tools for programmers, including macros, configurable syntax highlighting, code folding, file type conversions, project management, regular expressions for search-and-replace,...

     (http://www.ultraedit.com/products/ultracompare.html)
  • xxdiff - Graphical File And Directories Comparator And Merge Tool


Other merge tools are cited in diff
Diff
In computing, diff is a file comparison utility that outputs the differences between two files. It is typically used to show the changes between one version of a file and a former version of the same file. Diff displays the changes made per line for text files. Modern implementations also...

.

External links

The source of this article is wikipedia, the free encyclopedia.  The text of this article is licensed under the GFDL.
 
x
OK