CLI Reference > Configuration Management Commands > si merge
si merge
merges data from two revisions of a project member into a working file
si merge [--mergeType=[confirm|cancel|automatic|manual]] [--onMergeConflict=[confirm|cancel|mark|launchtool|highlight|error]] [--[no]failOnAmbiguousProject] [--outputFile=value] [-r rev] [--resolve] [--guiCharacterEncoding=value] [(-R|--[no|confirm]recurse)] [--filter=filteroptions] [(-S sandbox|--sandbox=sandbox)] [--hostname=server] [--port=number] [--password=password] [--user=name] [(-?|--usage)] [(-F file|--selectionFile=file)] [(-N|--no)] [(-Y|--yes)] [--[no]batch] [--cwd=directory] [--forceConfirm=[yes|no]] [(-g|--gui)] [--quiet] [--settingsUI=[gui|default]] [--status=[none|gui|default]] sandbox member...
si merge merges data from two revisions of a project member against a root revision. By default, the result overwrites the working file. This operates in a Sandbox. You cannot perform a merge on a project-only basis, since the result is left in your Sandbox.
The second -r rev specified is merged with the revision in the current working file. The first -r rev specified is the root revision. Both the working file revision and the other revision should have been derived from this root revision. For example, suppose development has branched from revision 1.3, with maintenance occurring on the 1.3.1 branch. Further suppose the tip of that branch is revision, the headrev member revision is 1.5, and that the revision in the Sandbox is 1.5.
1.5 (headrev)
1.4 (maintenance branch tip)
1.3 (root)
The command si merge -r 1.3 -r merges the changes in that have occurred since 1.3, into revision 1.5 in the working file in the Sandbox.
si merge is useful for combining separate changes into a checked out revision. Suppose root is the original, and both headrev and branch tip are modifications of root. Then, si merge combines both changes.
An overlap occurs if both branches of development (headrev and branch tip) have changes in a common segment of lines. Depending on the value used in --onMergeConflict, si merge displays how many overlaps occurred, and includes both alternatives in the result, delimiting them as follows:
<<<<<<< file1
lines in file1
lines in file2
>>>>>>> file2
If there are overlaps, by default Windchill RV&S asks you how you want to resolve the conflict. If you specify --mergeType=automatic and --onMergeConflict=highlight, it is up to you to determine how to resolve the conflict by editing the result.
This command takes the universal options available to all si commands, as well as some general options. See the options reference page for descriptions.
specifies how you want to complete the merge.
--mergeType=confirm prompts you to confirm a merge type.
--mergeType=cancel cancels the selected merge.
--mergeType=automatic completes the merge process without launching the Visual Merge tool.
While Windchill RV&S and Visual Merge are capable of performing automatic merging, PTC cannot guarantee that the merged results are “correct”. PTC recommends that you examine and test the merged results before checking them into the repository.
--mergeType=manual completes the merge operation through the Visual Merge tool or a third party merge tool, depending on your Difference and Merge Tool preferences. The merge tool launches, displaying the revisions you want to merge. For more information on the Visual Merge tool, refer to the Windchill RV&S Help Center.
--onMergeConflict =[confirm|cancel|mark|launchtool|highlight|error]
specifies what to do when conflicts occur during the merge.
--onMergeConflict=confirm prompts you to confirm a merge conflict option.
--onMergeConflict=cancel cancels the merge.
--onMergeConflict=mark marks the working file in your Sandbox indicating that merging is required without completing all of the merge related tasks. This provides the time to investigate conflicts, edit, or difference blocks before finishing the merge.
To display the affected member revisions, use the si print --filter=unresolvedmerges command. After you resolve the merge conflicts, merge the revisions using the si merge --resolve command.
--onMergeConflict=launchtool launches the Visual Merge tool to resolve the conflicts, all non-conflicting blocks will already have been applied.
--onMergeConflict=highlight indicates conflicts in the working file with the following characters: "<<<<<<" and ">>>>>>". You are responsible for manually resolving conflicts in the working file.
--onMergeConflict=launchtool does not require the -g or --gui options.
--onMergeConflict=error displays an error when a merge conflict is encountered.
identifies the location and name of a file that is to contain the result of merging data from two member revisions. If you do not specify a file, the working file is used.
-r rev
uses a specified revision. value can be a valid revision number or a label.
Specify this option twice to identify the two revisions to be merged; the first instance is the "old" revision, the second is the "new". The changes needed to make the "old" into the "new" are then incorporated into the working file or into the --outputFile. If you specify the -r rev option only once, si merge uses the latest revision on the default branch as the other revision.
merges a previously unresolved merge.
specifies the character encoding to use for the revision contents in the GUI, and can only be specified with the -g option. Windchill RV&S automatically decodes UTF-8 revision contents based on the presence of a byte order mark (BOM) in the file. You can set character encoding preferences for each view and command through your client preferences. The preference setting is used if the character set cannot be determined through the file’s BOM, or if no character set is specified in the command line. By default, the character set in the preferences matches the default character set provided by the client’s operating system locale. The option does not apply to pure CLI output, or third party merge and/or differencing tools. Possible values are:
ISO-8859 -1
ISO-8859 -15
sandbox member...
identifies a specific member; use spaces to specify more than one member.
See the diagnostics reference page for possible exit status values.
Using si setprefs or si viewprefs, you are able to set or view the preference keys for this command.
See Also
Commands: si ci, si co, si diff, si mergebranch, si revisioninfo
Miscellaneous: diagnostics, options, preferences