Up | Content | Intro | Concepts | Operations | Dictionary
Merging is a process of combining changes from different branches. Usually this is required when people are working in parallel on the same source code. The file versions in each branch are compared and analysed line by line.
When only one of the branches changes the file, then git will just move the branch tip of the target branch to match the latest revision of the file.
The rebasing command will copy commits from the current branch and place them on top of another branch. Rebasing MUST be used only on the local history as it can break down the development process.
When two branches have changes in the same file, then git will analyse the files to determine how to combine the differences. The 3-way merge algorithm uses a common ancestor and the two branch tips to perform the analysis.
It looks for sections which are the same in two of the three revisions. This indicates that the third revision is unique and the section will be added to the merge result. Sections that are different in all three revisions are marked as a conflict situation and left for the user to resolve.
- Recursive 3-Way on two branches
- Subtree on two branches
- Octopus on more than two branches
- Ours on more than two branches