blob: 6cd9ff6451db8a85869fd379e0603d1290aa9d3a [file] [log] [blame]
Junio C Hamano1a4e8412005-12-27 08:17:231<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
2 "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
3<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
4<head>
5<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
Junio C Hamanoba4b9282008-07-06 05:20:316<meta name="generator" content="AsciiDoc 8.2.5" />
Junio C Hamano1a4e8412005-12-27 08:17:237<style type="text/css">
8/* Debug borders */
9p, li, dt, dd, div, pre, h1, h2, h3, h4, h5, h6 {
10/*
11 border: 1px solid red;
12*/
13}
14
15body {
16 margin: 1em 5% 1em 5%;
17}
18
Junio C Hamanoba4b9282008-07-06 05:20:3119a {
20 color: blue;
21 text-decoration: underline;
22}
23a:visited {
24 color: fuchsia;
25}
Junio C Hamano1a4e8412005-12-27 08:17:2326
27em {
28 font-style: italic;
29}
30
31strong {
32 font-weight: bold;
33}
34
35tt {
36 color: navy;
37}
38
39h1, h2, h3, h4, h5, h6 {
40 color: #527bbd;
41 font-family: sans-serif;
42 margin-top: 1.2em;
43 margin-bottom: 0.5em;
44 line-height: 1.3;
45}
46
Junio C Hamanoba4b9282008-07-06 05:20:3147h1, h2, h3 {
Junio C Hamano1a4e8412005-12-27 08:17:2348 border-bottom: 2px solid silver;
49}
50h2 {
Junio C Hamano1a4e8412005-12-27 08:17:2351 padding-top: 0.5em;
52}
Junio C Hamanoba4b9282008-07-06 05:20:3153h3 {
54 float: left;
55}
56h3 + * {
57 clear: left;
58}
Junio C Hamano1a4e8412005-12-27 08:17:2359
60div.sectionbody {
61 font-family: serif;
62 margin-left: 0;
63}
64
65hr {
66 border: 1px solid silver;
67}
68
69p {
70 margin-top: 0.5em;
71 margin-bottom: 0.5em;
72}
73
74pre {
75 padding: 0;
76 margin: 0;
77}
78
79span#author {
80 color: #527bbd;
81 font-family: sans-serif;
82 font-weight: bold;
Junio C Hamanoba4b9282008-07-06 05:20:3183 font-size: 1.1em;
Junio C Hamano1a4e8412005-12-27 08:17:2384}
85span#email {
86}
87span#revision {
88 font-family: sans-serif;
89}
90
91div#footer {
92 font-family: sans-serif;
93 font-size: small;
94 border-top: 2px solid silver;
95 padding-top: 0.5em;
96 margin-top: 4.0em;
97}
98div#footer-text {
99 float: left;
100 padding-bottom: 0.5em;
101}
102div#footer-badges {
103 float: right;
104 padding-bottom: 0.5em;
105}
106
107div#preamble,
108div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
109div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
110div.admonitionblock {
111 margin-right: 10%;
112 margin-top: 1.5em;
113 margin-bottom: 1.5em;
114}
115div.admonitionblock {
116 margin-top: 2.5em;
117 margin-bottom: 2.5em;
118}
119
120div.content { /* Block element content. */
121 padding: 0;
122}
123
124/* Block element titles. */
125div.title, caption.title {
126 font-family: sans-serif;
127 font-weight: bold;
128 text-align: left;
129 margin-top: 1.0em;
130 margin-bottom: 0.5em;
131}
132div.title + * {
133 margin-top: 0;
134}
135
136td div.title:first-child {
137 margin-top: 0.0em;
138}
139div.content div.title:first-child {
140 margin-top: 0.0em;
141}
142div.content + div.title {
143 margin-top: 0.0em;
144}
145
146div.sidebarblock > div.content {
147 background: #ffffee;
148 border: 1px solid silver;
149 padding: 0.5em;
150}
151
Junio C Hamanoba4b9282008-07-06 05:20:31152div.listingblock {
153 margin-right: 0%;
154}
Junio C Hamano1a4e8412005-12-27 08:17:23155div.listingblock > div.content {
156 border: 1px solid silver;
157 background: #f4f4f4;
158 padding: 0.5em;
159}
160
161div.quoteblock > div.content {
162 padding-left: 2.0em;
163}
Junio C Hamanoba4b9282008-07-06 05:20:31164
165div.attribution {
Junio C Hamano1a4e8412005-12-27 08:17:23166 text-align: right;
167}
Junio C Hamanoba4b9282008-07-06 05:20:31168div.verseblock + div.attribution {
169 text-align: left;
170}
Junio C Hamano1a4e8412005-12-27 08:17:23171
172div.admonitionblock .icon {
173 vertical-align: top;
174 font-size: 1.1em;
175 font-weight: bold;
176 text-decoration: underline;
177 color: #527bbd;
178 padding-right: 0.5em;
179}
180div.admonitionblock td.content {
181 padding-left: 0.5em;
182 border-left: 2px solid silver;
183}
184
185div.exampleblock > div.content {
186 border-left: 2px solid silver;
187 padding: 0.5em;
188}
189
190div.verseblock div.content {
191 white-space: pre;
192}
193
194div.imageblock div.content { padding-left: 0; }
195div.imageblock img { border: 1px solid silver; }
196span.image img { border-style: none; }
197
198dl {
199 margin-top: 0.8em;
200 margin-bottom: 0.8em;
201}
202dt {
203 margin-top: 0.5em;
204 margin-bottom: 0;
205 font-style: italic;
206}
207dd > *:first-child {
208 margin-top: 0;
209}
210
211ul, ol {
212 list-style-position: outside;
213}
Junio C Hamanoba4b9282008-07-06 05:20:31214div.olist2 ol {
Junio C Hamano1a4e8412005-12-27 08:17:23215 list-style-type: lower-alpha;
216}
217
218div.tableblock > table {
Junio C Hamanoba4b9282008-07-06 05:20:31219 border: 3px solid #527bbd;
Junio C Hamano1a4e8412005-12-27 08:17:23220}
221thead {
222 font-family: sans-serif;
223 font-weight: bold;
224}
225tfoot {
226 font-weight: bold;
227}
228
229div.hlist {
230 margin-top: 0.8em;
231 margin-bottom: 0.8em;
232}
Junio C Hamanoba4b9282008-07-06 05:20:31233div.hlist td {
234 padding-bottom: 5px;
235}
Junio C Hamano1a4e8412005-12-27 08:17:23236td.hlist1 {
237 vertical-align: top;
238 font-style: italic;
239 padding-right: 0.8em;
240}
241td.hlist2 {
242 vertical-align: top;
243}
244
245@media print {
246 div#footer-badges { display: none; }
247}
Junio C Hamanoba4b9282008-07-06 05:20:31248
249div#toctitle {
250 color: #527bbd;
251 font-family: sans-serif;
252 font-size: 1.1em;
253 font-weight: bold;
254 margin-top: 1.0em;
255 margin-bottom: 0.1em;
256}
257
258div.toclevel1, div.toclevel2, div.toclevel3, div.toclevel4 {
259 margin-top: 0;
260 margin-bottom: 0;
261}
262div.toclevel2 {
263 margin-left: 2em;
264 font-size: 0.9em;
265}
266div.toclevel3 {
267 margin-left: 4em;
268 font-size: 0.9em;
269}
270div.toclevel4 {
271 margin-left: 6em;
272 font-size: 0.9em;
273}
274include1::./stylesheets/xhtml11-manpage.css[]
Junio C Hamano1a4e8412005-12-27 08:17:23275/* Workarounds for IE6's broken and incomplete CSS2. */
276
277div.sidebar-content {
278 background: #ffffee;
279 border: 1px solid silver;
280 padding: 0.5em;
281}
282div.sidebar-title, div.image-title {
283 font-family: sans-serif;
284 font-weight: bold;
285 margin-top: 0.0em;
286 margin-bottom: 0.5em;
287}
288
289div.listingblock div.content {
290 border: 1px solid silver;
291 background: #f4f4f4;
292 padding: 0.5em;
293}
294
295div.quoteblock-content {
296 padding-left: 2.0em;
297}
298
299div.exampleblock-content {
300 border-left: 2px solid silver;
301 padding-left: 0.5em;
302}
Junio C Hamanoba4b9282008-07-06 05:20:31303
304/* IE6 sets dynamically generated links as visited. */
305div#toc a:visited { color: blue; }
Junio C Hamano1a4e8412005-12-27 08:17:23306</style>
307<title>git-rebase(1)</title>
308</head>
309<body>
310<div id="header">
311<h1>
312git-rebase(1) Manual Page
313</h1>
314<h2>NAME</h2>
315<div class="sectionbody">
316<p>git-rebase -
Junio C Hamano7c73c662007-01-19 00:37:50317 Forward-port local commits to the updated upstream head
Junio C Hamano1a4e8412005-12-27 08:17:23318</p>
319</div>
320</div>
321<h2>SYNOPSIS</h2>
322<div class="sectionbody">
Junio C Hamanoa9b8d242007-05-19 04:51:55323<div class="verseblock">
Junio C Hamanobd53dbf2009-01-18 18:26:37324<div class="content"><em>git rebase</em> [-i | --interactive] [options] [--onto &lt;newbase&gt;]
325 &lt;upstream&gt; [&lt;branch&gt;]
326<em>git rebase</em> [-i | --interactive] [options] --onto &lt;newbase&gt;
327 --root [&lt;branch&gt;]</div></div>
328<div class="para"><p><em>git rebase</em> --continue | --skip | --abort</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:23329</div>
Junio C Hamanoba4b9282008-07-06 05:20:31330<h2 id="_description">DESCRIPTION</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23331<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31332<div class="para"><p>If &lt;branch&gt; is specified, <em>git-rebase</em> will perform an automatic
Junio C Hamano89d4e0f2007-02-18 00:34:59333<tt>git checkout &lt;branch&gt;</tt> before doing anything else. Otherwise
Junio C Hamanoba4b9282008-07-06 05:20:31334it remains on the current branch.</p></div>
335<div class="para"><p>All changes made by commits in the current branch but that are not
Junio C Hamano89d4e0f2007-02-18 00:34:59336in &lt;upstream&gt; are saved to a temporary area. This is the same set
Junio C Hamanobd53dbf2009-01-18 18:26:37337of commits that would be shown by <tt>git log &lt;upstream&gt;..HEAD</tt> (or
338<tt>git log HEAD</tt>, if --root is specified).</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:31339<div class="para"><p>The current branch is reset to &lt;upstream&gt;, or &lt;newbase&gt; if the
Junio C Hamano89d4e0f2007-02-18 00:34:59340--onto option was supplied. This has the exact same effect as
Junio C Hamano38ddcce2008-07-15 15:49:03341<tt>git reset --hard &lt;upstream&gt;</tt> (or &lt;newbase&gt;). ORIG_HEAD is set
342to point at the tip of the branch before the reset.</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:31343<div class="para"><p>The commits that were previously saved into the temporary area are
Junio C Hamano764a6672007-10-23 01:23:31344then reapplied to the current branch, one by one, in order. Note that
345any commits in HEAD which introduce the same textual changes as a commit
346in HEAD..&lt;upstream&gt; are omitted (i.e., a patch already accepted upstream
Junio C Hamanoba4b9282008-07-06 05:20:31347with a different commit message or timestamp will be skipped).</p></div>
348<div class="para"><p>It is possible that a merge failure will prevent this process from being
Junio C Hamano6112cad2006-05-02 07:28:06349completely automatic. You will have to resolve any such merge failure
Junio C Hamano6959c6c2006-05-17 10:34:11350and run <tt>git rebase --continue</tt>. Another option is to bypass the commit
351that caused the merge failure with <tt>git rebase --skip</tt>. To restore the
Junio C Hamano0868a302008-07-22 09:20:44352original &lt;branch&gt; and remove the .git/rebase-apply working files, use the
353command <tt>git rebase --abort</tt> instead.</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:31354<div class="para"><p>Assume the following history exists and the current branch is "topic":</p></div>
Junio C Hamano6112cad2006-05-02 07:28:06355<div class="listingblock">
Junio C Hamano7e9f6b72006-02-22 10:44:55356<div class="content">
Junio C Hamano6112cad2006-05-02 07:28:06357<pre><tt> A---B---C topic
358 /
359 D---E---F---G master</tt></pre>
Junio C Hamano7e9f6b72006-02-22 10:44:55360</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31361<div class="para"><p>From this point, the result of either of the following commands:</p></div>
Junio C Hamano7e9f6b72006-02-22 10:44:55362<div class="literalblock">
363<div class="content">
Junio C Hamanofce7c7e2008-07-02 03:06:38364<pre><tt>git rebase master
365git rebase master topic</tt></pre>
Junio C Hamano7e9f6b72006-02-22 10:44:55366</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31367<div class="para"><p>would be:</p></div>
Junio C Hamano6112cad2006-05-02 07:28:06368<div class="listingblock">
Junio C Hamano7e9f6b72006-02-22 10:44:55369<div class="content">
Junio C Hamano6112cad2006-05-02 07:28:06370<pre><tt> A'--B'--C' topic
371 /
372 D---E---F---G master</tt></pre>
Junio C Hamano7e9f6b72006-02-22 10:44:55373</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31374<div class="para"><p>The latter form is just a short-hand of <tt>git checkout topic</tt>
375followed by <tt>git rebase master</tt>.</p></div>
376<div class="para"><p>If the upstream branch already contains a change you have made (e.g.,
Junio C Hamano764a6672007-10-23 01:23:31377because you mailed a patch which was applied upstream), then that commit
Junio C Hamanofce7c7e2008-07-02 03:06:38378will be skipped. For example, running <tt>git rebase master</tt> on the
Junio C Hamano764a6672007-10-23 01:23:31379following history (in which A' and A introduce the same set of changes,
Junio C Hamanoba4b9282008-07-06 05:20:31380but have different committer information):</p></div>
Junio C Hamano764a6672007-10-23 01:23:31381<div class="listingblock">
382<div class="content">
383<pre><tt> A---B---C topic
384 /
385 D---E---A'---F master</tt></pre>
386</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31387<div class="para"><p>will result in:</p></div>
Junio C Hamano764a6672007-10-23 01:23:31388<div class="listingblock">
389<div class="content">
390<pre><tt> B'---C' topic
391 /
392 D---E---A'---F master</tt></pre>
393</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31394<div class="para"><p>Here is how you would transplant a topic branch based on one
Junio C Hamanod8c9d432006-11-07 07:19:13395branch to another, to pretend that you forked the topic branch
Junio C Hamanoba4b9282008-07-06 05:20:31396from the latter branch, using <tt>rebase --onto</tt>.</p></div>
397<div class="para"><p>First let's assume your <em>topic</em> is based on branch <em>next</em>.
Junio C Hamanoa476efa2008-10-10 15:31:42398For example, a feature developed in <em>topic</em> depends on some
Junio C Hamanoba4b9282008-07-06 05:20:31399functionality which is found in <em>next</em>.</p></div>
Junio C Hamano6112cad2006-05-02 07:28:06400<div class="listingblock">
Junio C Hamano7e9f6b72006-02-22 10:44:55401<div class="content">
Junio C Hamanod8c9d432006-11-07 07:19:13402<pre><tt> o---o---o---o---o master
403 \
404 o---o---o---o---o next
405 \
406 o---o---o topic</tt></pre>
Junio C Hamano7e9f6b72006-02-22 10:44:55407</div></div>
Junio C Hamanoa476efa2008-10-10 15:31:42408<div class="para"><p>We want to make <em>topic</em> forked from branch <em>master</em>; for example,
409because the functionality on which <em>topic</em> depends was merged into the
410more stable <em>master</em> branch. We want our tree to look like this:</p></div>
Junio C Hamanod8c9d432006-11-07 07:19:13411<div class="listingblock">
412<div class="content">
413<pre><tt> o---o---o---o---o master
414 | \
415 | o'--o'--o' topic
416 \
417 o---o---o---o---o next</tt></pre>
418</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31419<div class="para"><p>We can get this using the following command:</p></div>
Junio C Hamanod8c9d432006-11-07 07:19:13420<div class="literalblock">
421<div class="content">
Junio C Hamanofce7c7e2008-07-02 03:06:38422<pre><tt>git rebase --onto master next topic</tt></pre>
Junio C Hamanod8c9d432006-11-07 07:19:13423</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31424<div class="para"><p>Another example of --onto option is to rebase part of a
425branch. If we have the following situation:</p></div>
Junio C Hamanod8c9d432006-11-07 07:19:13426<div class="listingblock">
427<div class="content">
428<pre><tt> H---I---J topicB
429 /
430 E---F---G topicA
431 /
432 A---B---C---D master</tt></pre>
433</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31434<div class="para"><p>then the command</p></div>
Junio C Hamanod8c9d432006-11-07 07:19:13435<div class="literalblock">
436<div class="content">
Junio C Hamanofce7c7e2008-07-02 03:06:38437<pre><tt>git rebase --onto master topicA topicB</tt></pre>
Junio C Hamanod8c9d432006-11-07 07:19:13438</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31439<div class="para"><p>would result in:</p></div>
Junio C Hamanod8c9d432006-11-07 07:19:13440<div class="listingblock">
441<div class="content">
442<pre><tt> H'--I'--J' topicB
443 /
444 | E---F---G topicA
445 |/
446 A---B---C---D master</tt></pre>
447</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31448<div class="para"><p>This is useful when topicB does not depend on topicA.</p></div>
449<div class="para"><p>A range of commits could also be removed with rebase. If we have
450the following situation:</p></div>
Junio C Hamano42f855f2007-02-06 00:09:38451<div class="listingblock">
452<div class="content">
453<pre><tt> E---F---G---H---I---J topicA</tt></pre>
454</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31455<div class="para"><p>then the command</p></div>
Junio C Hamano42f855f2007-02-06 00:09:38456<div class="literalblock">
457<div class="content">
Junio C Hamanofce7c7e2008-07-02 03:06:38458<pre><tt>git rebase --onto topicA~5 topicA~3 topicA</tt></pre>
Junio C Hamano42f855f2007-02-06 00:09:38459</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31460<div class="para"><p>would result in the removal of commits F and G:</p></div>
Junio C Hamano42f855f2007-02-06 00:09:38461<div class="listingblock">
462<div class="content">
463<pre><tt> E---H'---I'---J' topicA</tt></pre>
464</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31465<div class="para"><p>This is useful if F and G were flawed in some way, or should not be
Junio C Hamano42f855f2007-02-06 00:09:38466part of topicA. Note that the argument to --onto and the &lt;upstream&gt;
Junio C Hamanoba4b9282008-07-06 05:20:31467parameter can be any valid commit-ish.</p></div>
468<div class="para"><p>In case of conflict, <em>git-rebase</em> will stop at the first problematic commit
469and leave conflict markers in the tree. You can use <em>git-diff</em> to locate
Junio C Hamano6112cad2006-05-02 07:28:06470the markers (&lt;&lt;&lt;&lt;&lt;&lt;) and make edits to resolve the conflict. For each
471file you edit, you need to tell git that the conflict has been resolved,
Junio C Hamanoba4b9282008-07-06 05:20:31472typically this would be done with</p></div>
Junio C Hamanof02e09f2006-03-27 07:51:03473<div class="literalblock">
474<div class="content">
Junio C Hamano89d4e0f2007-02-18 00:34:59475<pre><tt>git add &lt;filename&gt;</tt></pre>
Junio C Hamano6112cad2006-05-02 07:28:06476</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31477<div class="para"><p>After resolving the conflict manually and updating the index with the
478desired resolution, you can continue the rebasing process with</p></div>
Junio C Hamano6112cad2006-05-02 07:28:06479<div class="literalblock">
480<div class="content">
481<pre><tt>git rebase --continue</tt></pre>
Junio C Hamanof02e09f2006-03-27 07:51:03482</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31483<div class="para"><p>Alternatively, you can undo the <em>git-rebase</em> with</p></div>
Junio C Hamanof02e09f2006-03-27 07:51:03484<div class="literalblock">
485<div class="content">
Junio C Hamano6112cad2006-05-02 07:28:06486<pre><tt>git rebase --abort</tt></pre>
Junio C Hamanof02e09f2006-03-27 07:51:03487</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23488</div>
Junio C Hamanoea6a7642009-03-11 23:56:19489<h2 id="_configuration">CONFIGURATION</h2>
490<div class="sectionbody">
491<div class="vlist"><dl>
492<dt>
493rebase.stat
494</dt>
495<dd>
496<p>
497 Whether to show a diffstat of what changed upstream since the last
498 rebase. False by default.
499</p>
500</dd>
501</dl></div>
502</div>
Junio C Hamanoba4b9282008-07-06 05:20:31503<h2 id="_options">OPTIONS</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23504<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31505<div class="vlist"><dl>
Junio C Hamano1a4e8412005-12-27 08:17:23506<dt>
Junio C Hamano7e9f6b72006-02-22 10:44:55507&lt;newbase&gt;
508</dt>
509<dd>
510<p>
511 Starting point at which to create the new commits. If the
512 --onto option is not specified, the starting point is
Junio C Hamano42f855f2007-02-06 00:09:38513 &lt;upstream&gt;. May be any valid commit, and not just an
514 existing branch name.
Junio C Hamano7e9f6b72006-02-22 10:44:55515</p>
516</dd>
517<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23518&lt;upstream&gt;
519</dt>
520<dd>
521<p>
Junio C Hamano42f855f2007-02-06 00:09:38522 Upstream branch to compare against. May be any valid commit,
523 not just an existing branch name.
Junio C Hamano1a4e8412005-12-27 08:17:23524</p>
525</dd>
526<dt>
Junio C Hamano2b135272006-03-18 07:45:42527&lt;branch&gt;
Junio C Hamano1a4e8412005-12-27 08:17:23528</dt>
529<dd>
530<p>
531 Working branch; defaults to HEAD.
532</p>
533</dd>
Junio C Hamano6112cad2006-05-02 07:28:06534<dt>
535--continue
536</dt>
537<dd>
538<p>
539 Restart the rebasing process after having resolved a merge conflict.
540</p>
541</dd>
542<dt>
543--abort
544</dt>
545<dd>
546<p>
547 Restore the original branch and abort the rebase operation.
548</p>
549</dd>
Junio C Hamano97f518c2006-06-22 19:49:35550<dt>
551--skip
552</dt>
553<dd>
554<p>
555 Restart the rebasing process by skipping the current patch.
Junio C Hamano97f518c2006-06-22 19:49:35556</p>
557</dd>
558<dt>
Junio C Hamanoeb415992008-06-08 22:49:47559-m
560</dt>
561<dt>
562--merge
Junio C Hamano97f518c2006-06-22 19:49:35563</dt>
564<dd>
565<p>
566 Use merging strategies to rebase. When the recursive (default) merge
567 strategy is used, this allows rebase to be aware of renames on the
568 upstream side.
569</p>
570</dd>
571<dt>
Junio C Hamanoeb415992008-06-08 22:49:47572-s &lt;strategy&gt;
573</dt>
574<dt>
575--strategy=&lt;strategy&gt;
Junio C Hamano97f518c2006-06-22 19:49:35576</dt>
577<dd>
578<p>
Junio C Hamano52d5def2009-05-21 16:27:43579 Use the given merge strategy.
Junio C Hamano97f518c2006-06-22 19:49:35580 If there is no <tt>-s</tt> option, a built-in list of strategies
Junio C Hamanoba4b9282008-07-06 05:20:31581 is used instead (<em>git-merge-recursive</em> when merging a single
582 head, <em>git-merge-octopus</em> otherwise). This implies --merge.
Junio C Hamano97f518c2006-06-22 19:49:35583</p>
584</dd>
Junio C Hamanofbe00522006-10-19 05:58:48585<dt>
Junio C Hamano2c14c8d2009-07-02 03:17:00586-q
587</dt>
588<dt>
589--quiet
590</dt>
591<dd>
592<p>
593 Be quiet. Implies --no-stat.
594</p>
595</dd>
596<dt>
Junio C Hamanoeb415992008-06-08 22:49:47597-v
598</dt>
599<dt>
600--verbose
Junio C Hamanofbe00522006-10-19 05:58:48601</dt>
602<dd>
603<p>
Junio C Hamanoea6a7642009-03-11 23:56:19604 Be verbose. Implies --stat.
605</p>
606</dd>
607<dt>
608--stat
609</dt>
610<dd>
611<p>
612 Show a diffstat of what changed upstream since the last rebase. The
613 diffstat is also controlled by the configuration option rebase.stat.
614</p>
615</dd>
616<dt>
617-n
618</dt>
619<dt>
620--no-stat
621</dt>
622<dd>
623<p>
624 Do not show a diffstat as part of the rebase process.
Junio C Hamanofbe00522006-10-19 05:58:48625</p>
626</dd>
Junio C Hamanod3339982007-02-09 08:38:48627<dt>
Junio C Hamano7d06a8a2008-10-20 05:42:33628--no-verify
629</dt>
630<dd>
631<p>
632 This option bypasses the pre-rebase hook. See also <a href="githooks.html">githooks(5)</a>.
633</p>
634</dd>
635<dt>
Junio C Hamanod3339982007-02-09 08:38:48636-C&lt;n&gt;
637</dt>
638<dd>
639<p>
640 Ensure at least &lt;n&gt; lines of surrounding context match before
641 and after each change. When fewer lines of surrounding
642 context exist they all must match. By default no context is
643 ever ignored.
644</p>
645</dd>
Junio C Hamano1d90cb02007-07-03 07:05:31646<dt>
Junio C Hamanoa973f1c2009-03-19 17:47:52647-f
648</dt>
649<dt>
650--force-rebase
651</dt>
652<dd>
653<p>
654 Force the rebase even if the current branch is a descendant
655 of the commit you are rebasing onto. Normally the command will
656 exit with the message "Current branch is up to date" in such a
657 situation.
658</p>
659</dd>
660<dt>
Junio C Hamanofe24db02009-08-22 05:10:47661--ignore-whitespace
662</dt>
663<dt>
Junio C Hamanof8a79222009-03-01 08:02:50664--whitespace=&lt;option&gt;
Junio C Hamano250f03e2007-09-10 01:33:28665</dt>
666<dd>
667<p>
Junio C Hamanofe24db02009-08-22 05:10:47668 These flag are passed to the <em>git-apply</em> program
Junio C Hamano250f03e2007-09-10 01:33:28669 (see <a href="git-apply.html">git-apply(1)</a>) that applies the patch.
Junio C Hamanoec3b9a72009-02-13 08:45:52670 Incompatible with the --interactive option.
Junio C Hamano250f03e2007-09-10 01:33:28671</p>
672</dd>
673<dt>
Junio C Hamanoa973f1c2009-03-19 17:47:52674--committer-date-is-author-date
675</dt>
676<dt>
677--ignore-date
678</dt>
679<dd>
680<p>
681 These flags are passed to <em>git-am</em> to easily change the dates
682 of the rebased commits (see <a href="git-am.html">git-am(1)</a>).
683</p>
684</dd>
685<dt>
Junio C Hamanoeb415992008-06-08 22:49:47686-i
687</dt>
688<dt>
689--interactive
Junio C Hamano1d90cb02007-07-03 07:05:31690</dt>
691<dd>
692<p>
693 Make a list of the commits which are about to be rebased. Let the
Junio C Hamanodbb64592007-09-01 11:17:39694 user edit that list before rebasing. This mode can also be used to
695 split commits (see SPLITTING COMMITS below).
Junio C Hamano1d90cb02007-07-03 07:05:31696</p>
697</dd>
698<dt>
Junio C Hamanoeb415992008-06-08 22:49:47699-p
700</dt>
701<dt>
702--preserve-merges
Junio C Hamano1d90cb02007-07-03 07:05:31703</dt>
704<dd>
705<p>
Junio C Hamano7d06a8a2008-10-20 05:42:33706 Instead of ignoring merges, try to recreate them.
Junio C Hamano1d90cb02007-07-03 07:05:31707</p>
708</dd>
Junio C Hamanobd53dbf2009-01-18 18:26:37709<dt>
710--root
711</dt>
712<dd>
713<p>
714 Rebase all commits reachable from &lt;branch&gt;, instead of
715 limiting them with an &lt;upstream&gt;. This allows you to rebase
716 the root commit(s) on a branch. Must be used with --onto, and
717 will skip changes already contained in &lt;newbase&gt; (instead of
718 &lt;upstream&gt;). When used together with --preserve-merges, <em>all</em>
719 root commits will be rewritten to have &lt;newbase&gt; as parent
720 instead.
721</p>
722</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31723</dl></div>
Junio C Hamano97f518c2006-06-22 19:49:35724</div>
Junio C Hamanoba4b9282008-07-06 05:20:31725<h2 id="_merge_strategies">MERGE STRATEGIES</h2>
Junio C Hamano97f518c2006-06-22 19:49:35726<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31727<div class="vlist"><dl>
Junio C Hamano97f518c2006-06-22 19:49:35728<dt>
729resolve
730</dt>
731<dd>
732<p>
733 This can only resolve two heads (i.e. the current branch
Junio C Hamano1de75722009-03-26 08:39:38734 and another branch you pulled from) using a 3-way merge
Junio C Hamano97f518c2006-06-22 19:49:35735 algorithm. It tries to carefully detect criss-cross
736 merge ambiguities and is considered generally safe and
737 fast.
738</p>
739</dd>
740<dt>
741recursive
742</dt>
743<dd>
744<p>
Junio C Hamano1de75722009-03-26 08:39:38745 This can only resolve two heads using a 3-way merge
746 algorithm. When there is more than one common
747 ancestor that can be used for 3-way merge, it creates a
Junio C Hamano97f518c2006-06-22 19:49:35748 merged tree of the common ancestors and uses that as
749 the reference tree for the 3-way merge. This has been
750 reported to result in fewer merge conflicts without
751 causing mis-merges by tests done on actual merge commits
752 taken from Linux 2.6 kernel development history.
753 Additionally this can detect and handle merges involving
754 renames. This is the default merge strategy when
755 pulling or merging one branch.
756</p>
757</dd>
758<dt>
759octopus
760</dt>
761<dd>
762<p>
Junio C Hamano1de75722009-03-26 08:39:38763 This resolves cases with more than two heads, but refuses to do
764 a complex merge that needs manual resolution. It is
Junio C Hamano97f518c2006-06-22 19:49:35765 primarily meant to be used for bundling topic branch
766 heads together. This is the default merge strategy when
Junio C Hamano1de75722009-03-26 08:39:38767 pulling or merging more than one branch.
Junio C Hamano97f518c2006-06-22 19:49:35768</p>
769</dd>
770<dt>
771ours
772</dt>
773<dd>
774<p>
775 This resolves any number of heads, but the result of the
776 merge is always the current branch head. It is meant to
777 be used to supersede old development history of side
778 branches.
779</p>
780</dd>
Junio C Hamanoe6c92032008-03-19 09:24:34781<dt>
782subtree
783</dt>
784<dd>
785<p>
786 This is a modified recursive strategy. When merging trees A and
787 B, if B corresponds to a subtree of A, B is first adjusted to
788 match the tree structure of A, instead of reading the trees at
789 the same level. This adjustment is also done to the common
790 ancestor tree.
791</p>
792</dd>
Junio C Hamanoba4b9282008-07-06 05:20:31793</dl></div>
Junio C Hamano1a4e8412005-12-27 08:17:23794</div>
Junio C Hamanoba4b9282008-07-06 05:20:31795<h2 id="_notes">NOTES</h2>
Junio C Hamano6112cad2006-05-02 07:28:06796<div class="sectionbody">
Junio C Hamano7d06a8a2008-10-20 05:42:33797<div class="para"><p>You should understand the implications of using <em>git-rebase</em> on a
798repository that you share. See also RECOVERING FROM UPSTREAM REBASE
799below.</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:31800<div class="para"><p>When the git-rebase command is run, it will first execute a "pre-rebase"
Junio C Hamano6112cad2006-05-02 07:28:06801hook if one exists. You can use this hook to do sanity checks and
802reject the rebase if it isn't appropriate. Please see the template
Junio C Hamanoba4b9282008-07-06 05:20:31803pre-rebase hook script for an example.</p></div>
804<div class="para"><p>Upon completion, &lt;branch&gt; will be the current branch.</p></div>
Junio C Hamano6112cad2006-05-02 07:28:06805</div>
Junio C Hamanoba4b9282008-07-06 05:20:31806<h2 id="_interactive_mode">INTERACTIVE MODE</h2>
Junio C Hamano1a4e8412005-12-27 08:17:23807<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31808<div class="para"><p>Rebasing interactively means that you have a chance to edit the commits
Junio C Hamano1d90cb02007-07-03 07:05:31809which are rebased. You can reorder the commits, and you can
Junio C Hamanoba4b9282008-07-06 05:20:31810remove them (weeding out bad or otherwise unwanted patches).</p></div>
811<div class="para"><p>The interactive mode is meant for this type of workflow:</p></div>
812<div class="olist"><ol>
Junio C Hamano1d90cb02007-07-03 07:05:31813<li>
814<p>
815have a wonderful idea
816</p>
817</li>
818<li>
819<p>
820hack on the code
821</p>
822</li>
823<li>
824<p>
825prepare a series for submission
826</p>
827</li>
828<li>
829<p>
830submit
831</p>
832</li>
Junio C Hamanoba4b9282008-07-06 05:20:31833</ol></div>
834<div class="para"><p>where point 2. consists of several instances of</p></div>
835<div class="olist2"><ol>
Junio C Hamano1d90cb02007-07-03 07:05:31836<li>
837<p>
838regular use
839</p>
Junio C Hamanoba4b9282008-07-06 05:20:31840<div class="olist"><ol>
Junio C Hamano1d90cb02007-07-03 07:05:31841<li>
842<p>
843finish something worthy of a commit
844</p>
845</li>
846<li>
847<p>
848commit
849</p>
850</li>
Junio C Hamanoba4b9282008-07-06 05:20:31851</ol></div>
Junio C Hamano1d90cb02007-07-03 07:05:31852</li>
853<li>
854<p>
855independent fixup
856</p>
Junio C Hamanoba4b9282008-07-06 05:20:31857<div class="olist"><ol>
Junio C Hamano1d90cb02007-07-03 07:05:31858<li>
859<p>
860realize that something does not work
861</p>
862</li>
863<li>
864<p>
865fix that
866</p>
867</li>
868<li>
869<p>
870commit it
871</p>
872</li>
Junio C Hamanoba4b9282008-07-06 05:20:31873</ol></div>
Junio C Hamano1d90cb02007-07-03 07:05:31874</li>
Junio C Hamanoba4b9282008-07-06 05:20:31875</ol></div>
876<div class="para"><p>Sometimes the thing fixed in b.2. cannot be amended to the not-quite
Junio C Hamano1d90cb02007-07-03 07:05:31877perfect commit it fixes, because that commit is buried deeply in a
878patch series. That is exactly what interactive rebase is for: use it
879after plenty of "a"s and "b"s, by rearranging and editing
Junio C Hamanoba4b9282008-07-06 05:20:31880commits, and squashing multiple commits into one.</p></div>
881<div class="para"><p>Start it with the last commit you want to retain as-is:</p></div>
Junio C Hamano1d90cb02007-07-03 07:05:31882<div class="literalblock">
883<div class="content">
884<pre><tt>git rebase -i &lt;after-this-commit&gt;</tt></pre>
885</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31886<div class="para"><p>An editor will be fired up with all the commits in your current branch
Junio C Hamano1d90cb02007-07-03 07:05:31887(ignoring merge commits), which come after the given commit. You can
888reorder the commits in this list to your heart's content, and you can
Junio C Hamanoba4b9282008-07-06 05:20:31889remove them. The list looks more or less like this:</p></div>
Junio C Hamano1d90cb02007-07-03 07:05:31890<div class="listingblock">
891<div class="content">
892<pre><tt>pick deadbee The oneline of this commit
893pick fa1afe1 The oneline of the next commit
894...</tt></pre>
895</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31896<div class="para"><p>The oneline descriptions are purely for your pleasure; <em>git-rebase</em> will
Junio C Hamano1d90cb02007-07-03 07:05:31897not look at them but at the commit names ("deadbee" and "fa1afe1" in this
Junio C Hamanoba4b9282008-07-06 05:20:31898example), so do not delete or edit the names.</p></div>
899<div class="para"><p>By replacing the command "pick" with the command "edit", you can tell
900<em>git-rebase</em> to stop after applying that commit, so that you can edit
Junio C Hamano1d90cb02007-07-03 07:05:31901the files and/or the commit message, amend the commit, and continue
Junio C Hamanoba4b9282008-07-06 05:20:31902rebasing.</p></div>
Junio C Hamano3d23a0a2009-10-19 08:04:30903<div class="para"><p>If you just want to edit the commit message for a commit, replace the
904command "pick" with the command "reword".</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:31905<div class="para"><p>If you want to fold two or more commits into one, replace the command
Junio C Hamano1d90cb02007-07-03 07:05:31906"pick" with "squash" for the second and subsequent commit. If the
907commits had different authors, it will attribute the squashed commit to
Junio C Hamanoba4b9282008-07-06 05:20:31908the author of the first commit.</p></div>
Junio C Hamano3d23a0a2009-10-19 08:04:30909<div class="para"><p><em>git-rebase</em> will stop when "pick" has been replaced with "edit" or
910when a command fails due to merge errors. When you are done editing
911and/or resolving conflicts you can continue with <tt>git rebase --continue</tt>.</p></div>
Junio C Hamanoba4b9282008-07-06 05:20:31912<div class="para"><p>For example, if you want to reorder the last 5 commits, such that what
Junio C Hamano1d90cb02007-07-03 07:05:31913was HEAD~4 becomes the new HEAD. To achieve that, you would call
Junio C Hamanoba4b9282008-07-06 05:20:31914<em>git-rebase</em> like this:</p></div>
Junio C Hamano1d90cb02007-07-03 07:05:31915<div class="listingblock">
916<div class="content">
917<pre><tt>$ git rebase -i HEAD~5</tt></pre>
918</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31919<div class="para"><p>And move the first patch to the end of the list.</p></div>
920<div class="para"><p>You might want to preserve merges, if you have a history like this:</p></div>
Junio C Hamano1d90cb02007-07-03 07:05:31921<div class="listingblock">
922<div class="content">
923<pre><tt> X
924 \
925 A---M---B
926 /
927---o---O---P---Q</tt></pre>
928</div></div>
Junio C Hamanoba4b9282008-07-06 05:20:31929<div class="para"><p>Suppose you want to rebase the side branch starting at "A" to "Q". Make
930sure that the current HEAD is "B", and call</p></div>
Junio C Hamano1d90cb02007-07-03 07:05:31931<div class="listingblock">
932<div class="content">
933<pre><tt>$ git rebase -i -p --onto Q O</tt></pre>
934</div></div>
935</div>
Junio C Hamanoba4b9282008-07-06 05:20:31936<h2 id="_splitting_commits">SPLITTING COMMITS</h2>
Junio C Hamanodbb64592007-09-01 11:17:39937<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:31938<div class="para"><p>In interactive mode, you can mark commits with the action "edit". However,
939this does not necessarily mean that <em>git-rebase</em> expects the result of this
Junio C Hamanodbb64592007-09-01 11:17:39940edit to be exactly one commit. Indeed, you can undo the commit, or you can
Junio C Hamanoba4b9282008-07-06 05:20:31941add other commits. This can be used to split a commit into two:</p></div>
942<div class="ilist"><ul>
Junio C Hamanodbb64592007-09-01 11:17:39943<li>
944<p>
Junio C Hamanofce7c7e2008-07-02 03:06:38945Start an interactive rebase with <tt>git rebase -i &lt;commit&gt;^</tt>, where
Junio C Hamanodbb64592007-09-01 11:17:39946 &lt;commit&gt; is the commit you want to split. In fact, any commit range
947 will do, as long as it contains that commit.
948</p>
949</li>
950<li>
951<p>
952Mark the commit you want to split with the action "edit".
953</p>
954</li>
955<li>
956<p>
Junio C Hamanofce7c7e2008-07-02 03:06:38957When it comes to editing that commit, execute <tt>git reset HEAD^</tt>. The
Junio C Hamanodbb64592007-09-01 11:17:39958 effect is that the HEAD is rewound by one, and the index follows suit.
959 However, the working tree stays the same.
960</p>
961</li>
962<li>
963<p>
964Now add the changes to the index that you want to have in the first
Junio C Hamanofce7c7e2008-07-02 03:06:38965 commit. You can use <tt>git add</tt> (possibly interactively) or
Junio C Hamanoba4b9282008-07-06 05:20:31966 <em>git-gui</em> (or both) to do that.
Junio C Hamanodbb64592007-09-01 11:17:39967</p>
968</li>
969<li>
970<p>
971Commit the now-current index with whatever commit message is appropriate
972 now.
973</p>
974</li>
975<li>
976<p>
977Repeat the last two steps until your working tree is clean.
978</p>
979</li>
980<li>
981<p>
Junio C Hamanofce7c7e2008-07-02 03:06:38982Continue the rebase with <tt>git rebase --continue</tt>.
Junio C Hamanodbb64592007-09-01 11:17:39983</p>
984</li>
Junio C Hamanoba4b9282008-07-06 05:20:31985</ul></div>
986<div class="para"><p>If you are not absolutely sure that the intermediate revisions are
Junio C Hamanodbb64592007-09-01 11:17:39987consistent (they compile, pass the testsuite, etc.) you should use
Junio C Hamanoba4b9282008-07-06 05:20:31988<em>git-stash</em> to stash away the not-yet-committed changes
989after each commit, test, and amend the commit if fixes are necessary.</p></div>
Junio C Hamanodbb64592007-09-01 11:17:39990</div>
Junio C Hamano7d06a8a2008-10-20 05:42:33991<h2 id="_recovering_from_upstream_rebase">RECOVERING FROM UPSTREAM REBASE</h2>
992<div class="sectionbody">
993<div class="para"><p>Rebasing (or any other form of rewriting) a branch that others have
994based work on is a bad idea: anyone downstream of it is forced to
995manually fix their history. This section explains how to do the fix
996from the downstream's point of view. The real fix, however, would be
997to avoid rebasing the upstream in the first place.</p></div>
998<div class="para"><p>To illustrate, suppose you are in a situation where someone develops a
999<em>subsystem</em> branch, and you are working on a <em>topic</em> that is dependent
1000on this <em>subsystem</em>. You might end up with a history like the
1001following:</p></div>
1002<div class="listingblock">
1003<div class="content">
1004<pre><tt> o---o---o---o---o---o---o---o---o master
1005 \
1006 o---o---o---o---o subsystem
1007 \
1008 *---*---* topic</tt></pre>
1009</div></div>
1010<div class="para"><p>If <em>subsystem</em> is rebased against <em>master</em>, the following happens:</p></div>
1011<div class="listingblock">
1012<div class="content">
1013<pre><tt> o---o---o---o---o---o---o---o master
1014 \ \
1015 o---o---o---o---o o'--o'--o'--o'--o' subsystem
1016 \
1017 *---*---* topic</tt></pre>
1018</div></div>
1019<div class="para"><p>If you now continue development as usual, and eventually merge <em>topic</em>
1020to <em>subsystem</em>, the commits from <em>subsystem</em> will remain duplicated forever:</p></div>
1021<div class="listingblock">
1022<div class="content">
1023<pre><tt> o---o---o---o---o---o---o---o master
1024 \ \
1025 o---o---o---o---o o'--o'--o'--o'--o'--M subsystem
1026 \ /
1027 *---*---*-..........-*--* topic</tt></pre>
1028</div></div>
1029<div class="para"><p>Such duplicates are generally frowned upon because they clutter up
1030history, making it harder to follow. To clean things up, you need to
1031transplant the commits on <em>topic</em> to the new <em>subsystem</em> tip, i.e.,
1032rebase <em>topic</em>. This becomes a ripple effect: anyone downstream from
1033<em>topic</em> is forced to rebase too, and so on!</p></div>
1034<div class="para"><p>There are two kinds of fixes, discussed in the following subsections:</p></div>
1035<div class="vlist"><dl>
1036<dt>
1037Easy case: The changes are literally the same.
1038</dt>
1039<dd>
1040<p>
1041 This happens if the <em>subsystem</em> rebase was a simple rebase and
1042 had no conflicts.
1043</p>
1044</dd>
1045<dt>
1046Hard case: The changes are not the same.
1047</dt>
1048<dd>
1049<p>
1050 This happens if the <em>subsystem</em> rebase had conflicts, or used
1051 <tt>--interactive</tt> to omit, edit, or squash commits; or if the
1052 upstream used one of <tt>commit --amend</tt>, <tt>reset</tt>, or
1053 <tt>filter-branch</tt>.
1054</p>
1055</dd>
1056</dl></div>
1057<h3 id="_the_easy_case">The easy case</h3><div style="clear:left"></div>
1058<div class="para"><p>Only works if the changes (patch IDs based on the diff contents) on
1059<em>subsystem</em> are literally the same before and after the rebase
1060<em>subsystem</em> did.</p></div>
1061<div class="para"><p>In that case, the fix is easy because <em>git-rebase</em> knows to skip
1062changes that are already present in the new upstream. So if you say
1063(assuming you're on <em>topic</em>)</p></div>
1064<div class="listingblock">
1065<div class="content">
1066<pre><tt> $ git rebase subsystem</tt></pre>
1067</div></div>
1068<div class="para"><p>you will end up with the fixed history</p></div>
1069<div class="listingblock">
1070<div class="content">
1071<pre><tt> o---o---o---o---o---o---o---o master
1072 \
1073 o'--o'--o'--o'--o' subsystem
1074 \
1075 *---*---* topic</tt></pre>
1076</div></div>
1077<h3 id="_the_hard_case">The hard case</h3><div style="clear:left"></div>
1078<div class="para"><p>Things get more complicated if the <em>subsystem</em> changes do not exactly
1079correspond to the ones before the rebase.</p></div>
1080<div class="admonitionblock">
1081<table><tr>
1082<td class="icon">
1083<div class="title">Note</div>
1084</td>
1085<td class="content">While an "easy case recovery" sometimes appears to be successful
1086 even in the hard case, it may have unintended consequences. For
1087 example, a commit that was removed via <tt>git rebase
1088 --interactive</tt> will be <strong>*resurrected</strong>*!</td>
1089</tr></table>
1090</div>
1091<div class="para"><p>The idea is to manually tell <em>git-rebase</em> "where the old <em>subsystem</em>
1092ended and your <em>topic</em> began", that is, what the old merge-base
1093between them was. You will have to find a way to name the last commit
1094of the old <em>subsystem</em>, for example:</p></div>
1095<div class="ilist"><ul>
1096<li>
1097<p>
1098With the <em>subsystem</em> reflog: after <em>git-fetch</em>, the old tip of
1099 <em>subsystem</em> is at <tt>subsystem@{1}</tt>. Subsequent fetches will
1100 increase the number. (See <a href="git-reflog.html">git-reflog(1)</a>.)
1101</p>
1102</li>
1103<li>
1104<p>
1105Relative to the tip of <em>topic</em>: knowing that your <em>topic</em> has three
1106 commits, the old tip of <em>subsystem</em> must be <tt>topic~3</tt>.
1107</p>
1108</li>
1109</ul></div>
1110<div class="para"><p>You can then transplant the old <tt>subsystem..topic</tt> to the new tip by
1111saying (for the reflog case, and assuming you are on <em>topic</em> already):</p></div>
1112<div class="listingblock">
1113<div class="content">
1114<pre><tt> $ git rebase --onto subsystem subsystem@{1}</tt></pre>
1115</div></div>
1116<div class="para"><p>The ripple effect of a "hard case" recovery is especially bad:
1117<em>everyone</em> downstream from <em>topic</em> will now have to perform a "hard
1118case" recovery too!</p></div>
1119</div>
Junio C Hamanoba4b9282008-07-06 05:20:311120<h2 id="_authors">Authors</h2>
Junio C Hamano1d90cb02007-07-03 07:05:311121<div class="sectionbody">
Junio C Hamano0868a302008-07-22 09:20:441122<div class="para"><p>Written by Junio C Hamano &lt;gitster@pobox.com&gt; and
Junio C Hamanoba4b9282008-07-06 05:20:311123Johannes E. Schindelin &lt;johannes.schindelin@gmx.de&gt;</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231124</div>
Junio C Hamanoba4b9282008-07-06 05:20:311125<h2 id="_documentation">Documentation</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231126<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:311127<div class="para"><p>Documentation by Junio C Hamano and the git-list &lt;git@vger.kernel.org&gt;.</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231128</div>
Junio C Hamanoba4b9282008-07-06 05:20:311129<h2 id="_git">GIT</h2>
Junio C Hamano1a4e8412005-12-27 08:17:231130<div class="sectionbody">
Junio C Hamanoba4b9282008-07-06 05:20:311131<div class="para"><p>Part of the <a href="git.html">git(1)</a> suite</p></div>
Junio C Hamano1a4e8412005-12-27 08:17:231132</div>
1133<div id="footer">
1134<div id="footer-text">
Junio C Hamano3d23a0a2009-10-19 08:04:301135Last updated 2009-10-19 08:04:10 UTC
Junio C Hamano1a4e8412005-12-27 08:17:231136</div>
1137</div>
1138</body>
1139</html>