Rebase topic streams
If you have a topic and parent stream that both contain changes, and you want to update the topic stream with the changes from its parent, you can rebase the topic stream.
Rebase guidelines
-
Rebase updates the content of the topic stream with the tip of the parent stream (or an earlier version).
-
Rebase merges the changes from the selected parent stream version, with all the changesets in the topic stream, into a single changeset on the topic stream.
-
Rebase is simpler and quicker than merging the streams. The rebase is performed in the repository and not using the work area.
-
Rebase is particularly useful when development work on a topic stream is taking a long time and you want to test your code with the latest updates in the parent stream.
-
Rebase makes reviews of changes simpler.
-
Rebase only works if there are no conflicts between the topic and mainline streams.
Rebase a topic stream
Rebase updates the content of the topic stream with the tip of the parent stream (or an earlier version).
To rebase from a stream:
-
In the desktop client, open a topic stream.
-
Select a stream from which to rebase.
-
(Optional) To rebase from an earlier version of the stream, click Select Version. Use the filters and date range to search for a specific version.
-
Click Rebase.
Rebase scenario
The following example describes a scenario of rebasing a topic stream.
-
A topic stream is created from a parent stream. Deliveries are made to both streams, which creates multiple changesets:
-
Parent stream changesets: p1, p2, p3
-
Topic stream changesets: t1,t2
-
-
Solution 1: merge
-
Merging changes from the parent into the topic stream using the work area creates a new changeset, t3, in the topic stream that includes all the changes from the parent stream.
-
The pull request for the topic stream includes the results of the merge, which makes it hard to see the real changes in the topic stream.
-
Solution 2: rebase
-
Rebasing merges all the changesets in the parent stream (p1, p2, p3) into a new changeset on the topic stream, t1’.
-
Rebase then merges the topic stream changesets (t1, t2) into a new changeset, t2’.
-
The pull request for the topic stream looks cleaner as it does not include the changes from p2 and p3 in the parent stream.
-