Edit online

Merging

At some stage during the development process, you will want to merge the changes made on a branch back into the trunk, or vice-versa. The merge is accomplished by comparing two points (branches or revisions) in the repository and applying the obtained differences to your working copy. This process is closely related to the diff concept.

Note: A branch is a line of development that exists independently of another line, yet still shares a common history if you look far enough back in time. A branch always begins life as a copy of something (such as a trunk, another branch, or tag), and moves on from there, generating its own history.

The Merge action is available in the Tools menu. The working copy item selected when you issued the command will be the one receiving the generated changes. If there is no item selected, the merge operation will be performed on the entire working copy.

Figure 1. Merge Wizard

The four types of merging are as follows:

  • Merge revisions - Port changes from one branch to another. Note that the trunk can also be considered a branch, in this context.
  • Synchronize branch - Fetch all the changes made on a parent branch (or the trunk) to a child branch.
  • Reintegrate a branch - Merge a branch back to its parent branch (can also be the trunk).
  • Merge two different trees - Integrate the changes done on a branch to a different branch.

It is recommended that you enable the following pre-merge check:

Perform pre-merge best practices checks of the working copy target - When selected, the SVN Client checks if the working copy target item is ready for the merge operation and displays the pre-merge checks wizard page.

Remember: It is a good idea to perform a merge into an unmodified working copy. If you have made changes to your working copy, commit them first. If the merge does not go as you expect, you may want to revert the changes and revert cannot recover your uncommitted modifications.
Important: The above recommendation becomes mandatory when reintegrating a branch.