Merge (version control)
In version control, merging (also called integration) is a fundamental operation that reconciles multiple changes made to a version-controlled collection of files. Most often, it is necessary when a file is modified on two independent branches and subsequently 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 there is sufficient history information to reconstruct the changes, and 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. Types of merges There are two types of merges: unstructured and structured. Unstructured merge Unstructured merge operates on raw text, typically using lines of text as atomic units. This is what Unix tools (diff/patch) and CVS tools (SVN, Git) use. This is limited, as a line of text does not represent the structure of source code. Structured merge Structured merge tools, or AST merge, turn the source code into a fully resolved AST. This allows for a fine-grained merge that avoid spurious conflicts. Workflow Automatic merging is what version control software does when it reconciles changes that have happened simultaneously