@@ -114,87 +114,6 @@ will result in:
114114 D---E---A'---F master
115115------------
116116
117- Here is how you would transplant a topic branch based on one
118- branch to another, to pretend that you forked the topic branch
119- from the latter branch, using `rebase --onto` .
120-
121- First let's assume your 'topic' is based on branch 'next' .
122- For example, a feature developed in 'topic' depends on some
123- functionality which is found in 'next' .
124-
125- ------------
126- o---o---o---o---o master
127- \
128- o---o---o---o---o next
129- \
130- o---o---o topic
131- ------------
132-
133- We want to make 'topic' forked from branch 'master' ; for example,
134- because the functionality on which 'topic' depends was merged into the
135- more stable 'master' branch. We want our tree to look like this:
136-
137- ------------
138- o---o---o---o---o master
139- | \
140- | o'--o'--o' topic
141- \
142- o---o---o---o---o next
143- ------------
144-
145- We can get this using the following command:
146-
147- git rebase --onto master next topic
148-
149-
150- Another example of --onto option is to rebase part of a
151- branch. If we have the following situation:
152-
153- ------------
154- H---I---J topicB
155- /
156- E---F---G topicA
157- /
158- A---B---C---D master
159- ------------
160-
161- then the command
162-
163- git rebase --onto master topicA topicB
164-
165- would result in:
166-
167- ------------
168- H'--I'--J' topicB
169- /
170- | E---F---G topicA
171- |/
172- A---B---C---D master
173- ------------
174-
175- This is useful when topicB does not depend on topicA.
176-
177- A range of commits could also be removed with rebase. If we have
178- the following situation:
179-
180- ------------
181- E---F---G---H---I---J topicA
182- ------------
183-
184- then the command
185-
186- git rebase --onto topicA~5 topicA~3 topicA
187-
188- would result in the removal of commits F and G:
189-
190- ------------
191- E---H'---I'---J' topicA
192- ------------
193-
194- This is useful if F and G were flawed in some way, or should not be
195- part of topicA. Note that the argument to `--onto` and the `<upstream>`
196- parameter can be any valid commit-ish.
197-
198117MODE OPTIONS
199118------------
200119
@@ -240,6 +159,8 @@ As a special case, you may use "A\...B" as a shortcut for the
240159merge base of A and B if there is exactly one merge base. You can
241160leave out at most one of A and B, in which case it defaults to HEAD.
242161
162+ See TRANSPLANTING A TOPIC BRANCH WITH -- ONTO below for examples.
163+
243164-- keep-base::
244165 Set the starting point at which to create the new commits to the
245166 merge base of `<upstream>` and `<branch>` . Running
@@ -1018,6 +939,91 @@ consistent (they compile, pass the testsuite, etc.) you should use
1018939after each commit, test, and amend the commit if fixes are necessary.
1019940
1020941
942+ TRANSPLANTING A TOPIC BRANCH WITH --ONTO
943+ ----------------------------------------
944+
945+ Here is how you would transplant a topic branch based on one
946+ branch to another, to pretend that you forked the topic branch
947+ from the latter branch, using `rebase --onto`.
948+
949+ First let's assume your 'topic' is based on branch 'next'.
950+ For example, a feature developed in 'topic' depends on some
951+ functionality which is found in 'next'.
952+
953+ ------------
954+ o---o---o---o---o master
955+ \
956+ o---o---o---o---o next
957+ \
958+ o---o---o topic
959+ ------------
960+
961+ We want to make 'topic' forked from branch 'master'; for example,
962+ because the functionality on which 'topic' depends was merged into the
963+ more stable 'master' branch. We want our tree to look like this:
964+
965+ ------------
966+ o---o---o---o---o master
967+ | \
968+ | o'--o'--o' topic
969+ \
970+ o---o---o---o---o next
971+ ------------
972+
973+ We can get this using the following command:
974+
975+ git rebase --onto master next topic
976+
977+
978+ Another example of --onto option is to rebase part of a
979+ branch. If we have the following situation:
980+
981+ ------------
982+ H---I---J topicB
983+ /
984+ E---F---G topicA
985+ /
986+ A---B---C---D master
987+ ------------
988+
989+ then the command
990+
991+ git rebase --onto master topicA topicB
992+
993+ would result in:
994+
995+ ------------
996+ H'--I'--J' topicB
997+ /
998+ | E---F---G topicA
999+ |/
1000+ A---B---C---D master
1001+ ------------
1002+
1003+ This is useful when topicB does not depend on topicA.
1004+
1005+ A range of commits could also be removed with rebase. If we have
1006+ the following situation:
1007+
1008+ ------------
1009+ E---F---G---H---I---J topicA
1010+ ------------
1011+
1012+ then the command
1013+
1014+ git rebase --onto topicA~5 topicA~3 topicA
1015+
1016+ would result in the removal of commits F and G:
1017+
1018+ ------------
1019+ E---H'---I'---J' topicA
1020+ ------------
1021+
1022+ This is useful if F and G were flawed in some way, or should not be
1023+ part of topicA. Note that the argument to `--onto` and the `<upstream>`
1024+ parameter can be any valid commit-ish.
1025+
1026+
10211027RECOVERING FROM UPSTREAM REBASE
10221028-------------------------------
10231029
0 commit comments