Merge specific changes between streams
When merging changes between streams, you can select changes related to specific requests, a process called cherrypicking. For example, you have delivered multiple sets of changes to a stream but want to merge one specific set into a different stream. This topic provides examples of picking changes during the merge.
Cherrypick a set of changes
In this example, there are two streams, RELEASE and MAINTENANCE. The MAINTENANCE stream was branched off the RELEASE stream from changeset 5.
Your team has made multiple deliveries to the RELEASE stream which has created changesets 6, 7, 8, and 9. The modifications in each changeset are related to a different request:
-
Request CR_1 is related to
item3;rel#4
. -
Request CR_2 is related to
item1;rel#2
anditem2;rel#4
. -
Request CR_3 is related to
item1;rel#3
anditem3;rel#5
.
In the MAINTENANCE stream you want to:
-
Merge the changes that were delivered in changeset 8 to the RELEASE stream (related to CR_3).
-
Ignore the previous changes delivered to the RELEASE stream (changesets 6 and 7).
Cherrypicking CR_3 during a merge from request operation only includes the changes applied when changeset 8 was created:
-
The difference between
item1;rel#2
anditem1;rel#3
. -
The difference between
item3;rel#4
anditem3;rel#5
.
The changes to item2
are not applied as it is not affected by CR_3.
The merge operation creates changeset 2 in the MAINTENANCE stream.
Tip:
-
If you perform a regular merge from request using CR_3, and do not specify the Cherrypick option, the entire contents of these files are merged:
-
item1;rel#3
(including changes initem1;rel#2
) -
item3;rel#5
(including changes initem3;rel#4
) -
To apply all the changes made before changeset 8 of the RELEASE stream was created, merge from a stream version (not a request).
Cherrypick multiple changes
In this example, there are two streams, RELEASE and MAINTENANCE. The MAINTENANCE stream was branched off the RELEASE stream from version 6.
Your team has made multiple deliveries to the RELEASE stream, creating changesets 7, 8, 9, and 10. The changes in changesets 8 and 10 are both related to the same request, CR_4.
In the MAINTENANCE stream you want to:
-
Merge the changes related to CR_4 in the RELEASE stream (changesets 8 and 10).
-
Ignore the other changes delivered to the RELEASE stream (changesets 7 and 9).
You can cherrypick the changes delivered in changeset 8 and 10 by selecting request CR_4 during a merge operation.
Tip: You can select multiple requests when cherrypicking.
Cherrypick multiple non-consecutive changes
The following file contains multiple changes:
-
Two of the changes are related to the same request (CR_42).
-
The other changes are related to different requests.
Each delivery has created a new revision of the file and a new changeset:
-
Changeset 2 contains revision r2016#2.
-
Changeset 4 contains revision r2016#4.
-
Both changesets are related to the same request (CR_42).
-
Changeset 3 contains r2016#3but is related to a different request (TASK_20).
-
The changesets related to CR_42 are not consecutive.
You need to:
-
Merge the two changes related to CR_42 into a target file in another stream.
-
Ignore the other changes.
You can cherrypick the required lines of code by specifically selecting request CR_42 during a merge from request operation.
If you interactively review and do not automatically merge non-conflicting file content, the change tree on the Review Changes page of the Merge wizard looks similar to this:
The default resolution for both revisions is Unresolved. Revision r2016#2 of the file was made before r2016#4. The changes applied by revision r2016#3 need to be excluded. Two merge operations are required, one for each delivery that was related to request CR_42:
-
Merge revision r2016#2 into the target file.
-
Save the target file.
-
Merge revision r2016#4 with the target file saved in the previous step.
Tip: To cherrypick one specific revision ignore the revisions that you do not want to merge.
If you automatically merge non-conflicting file conflicts, the change tree on the Review Changes page of the Merge wizard looks similar to this:
The default resolution for both revisions is Merge. The changes have been merged successfully by the default merge tool into the target.
See also:
- Web client: Merge changes across streams
- Desktop client: Merge changes across streams