At some stage during the development you will want to merge the changes made on one branch back into the trunk, or vice versa.

Merge is closely related to Diff. The merge is accomplished by comparing two points (branches or revisions) in the repository and applying the obtained differences to your working copy.

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.

The Merge command can be found in the Tools main menu of the Syncro SVN Client. The directory selected when you issued the command will be the result directory of the merge operation.

There are three common types of merging which are handled in different ways, as described below. The first page of the merge operation wizard allows you to select the merging method.

Figure 3.20. The Merge type dialog

The Merge type dialog

Merge revisions

This is the case when you have made one or more revisions to a branch (or to the trunk) and you want to port those changes across to a different branch or trunk. An example of such operation can be the following: Calculate the changes necessary to get (from) revision 17 of branch B1 (to) revision 25 of branch B1, and apply those changes to my working copy, of the trunk or another branch.

Figure 3.21. Merge revisions range dialog

Merge revisions range dialog

Enter the folder URL of the branch or tag containing the changes you want to port into your working copy In the From: field. You may also click the Browse button to browse the repository and find the desired branch. If you have merged from this branch before, then just use the drop down list which shows a history of previously used URLs.

In the Revision range to merge section you can choose to merge all revisions or enter the list of revisions you want to merge in the Revision range field. This can be a single revision, a list of comma separated specific revisions, or a range of revisions separated by a dash, or any combination of these.

You can click on History button to select in the easiest way the list of revisions to be merged. One or several revisions can be selected then by clicking on OK the list of revision numbers to merge will be filled in the Revision range text field.

If you want to merge changes back out of your working copy, to revert a change which has already been committed, select the revisions to revert and check the Reverse merge box.

If you have already merged some changes from this branch and you remember the last merged revision, you can use History for the Working Copy to trace that revision. For example, if you have merged revisions 27 to 33 last time, then the start point for this merge operation should be revision 33.

Subversion has merge tracking features and automatically records the last merged revision so you do not need to remember when you performed the last merge.

Be careful about using the HEAD revision. It may not refer to the revision you think it does if someone else made a commit after your last update.

The target panel of the dialog reminds you the location of the target resource from the working copy where the merge result will be saved and its corresponding repository URL.

Click Next and go to Merge Options.