blob: 997b2ff5a9bdfbba0eb4a0c9192e66dae1b5bad7 [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 Hamano7e9f6b72006-02-22 10:44:556<meta name="generator" content="AsciiDoc 7.0.2" />
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
19a { color: blue; }
20a:visited { color: fuchsia; }
21
22em {
23 font-style: italic;
24}
25
26strong {
27 font-weight: bold;
28}
29
30tt {
31 color: navy;
32}
33
34h1, h2, h3, h4, h5, h6 {
35 color: #527bbd;
36 font-family: sans-serif;
37 margin-top: 1.2em;
38 margin-bottom: 0.5em;
39 line-height: 1.3;
40}
41
42h1 {
43 border-bottom: 2px solid silver;
44}
45h2 {
46 border-bottom: 2px solid silver;
47 padding-top: 0.5em;
48}
49
50div.sectionbody {
51 font-family: serif;
52 margin-left: 0;
53}
54
55hr {
56 border: 1px solid silver;
57}
58
59p {
60 margin-top: 0.5em;
61 margin-bottom: 0.5em;
62}
63
64pre {
65 padding: 0;
66 margin: 0;
67}
68
69span#author {
70 color: #527bbd;
71 font-family: sans-serif;
72 font-weight: bold;
73 font-size: 1.2em;
74}
75span#email {
76}
77span#revision {
78 font-family: sans-serif;
79}
80
81div#footer {
82 font-family: sans-serif;
83 font-size: small;
84 border-top: 2px solid silver;
85 padding-top: 0.5em;
86 margin-top: 4.0em;
87}
88div#footer-text {
89 float: left;
90 padding-bottom: 0.5em;
91}
92div#footer-badges {
93 float: right;
94 padding-bottom: 0.5em;
95}
96
97div#preamble,
98div.tableblock, div.imageblock, div.exampleblock, div.verseblock,
99div.quoteblock, div.literalblock, div.listingblock, div.sidebarblock,
100div.admonitionblock {
101 margin-right: 10%;
102 margin-top: 1.5em;
103 margin-bottom: 1.5em;
104}
105div.admonitionblock {
106 margin-top: 2.5em;
107 margin-bottom: 2.5em;
108}
109
110div.content { /* Block element content. */
111 padding: 0;
112}
113
114/* Block element titles. */
115div.title, caption.title {
116 font-family: sans-serif;
117 font-weight: bold;
118 text-align: left;
119 margin-top: 1.0em;
120 margin-bottom: 0.5em;
121}
122div.title + * {
123 margin-top: 0;
124}
125
126td div.title:first-child {
127 margin-top: 0.0em;
128}
129div.content div.title:first-child {
130 margin-top: 0.0em;
131}
132div.content + div.title {
133 margin-top: 0.0em;
134}
135
136div.sidebarblock > div.content {
137 background: #ffffee;
138 border: 1px solid silver;
139 padding: 0.5em;
140}
141
142div.listingblock > div.content {
143 border: 1px solid silver;
144 background: #f4f4f4;
145 padding: 0.5em;
146}
147
148div.quoteblock > div.content {
149 padding-left: 2.0em;
150}
151div.quoteblock .attribution {
152 text-align: right;
153}
154
155div.admonitionblock .icon {
156 vertical-align: top;
157 font-size: 1.1em;
158 font-weight: bold;
159 text-decoration: underline;
160 color: #527bbd;
161 padding-right: 0.5em;
162}
163div.admonitionblock td.content {
164 padding-left: 0.5em;
165 border-left: 2px solid silver;
166}
167
168div.exampleblock > div.content {
169 border-left: 2px solid silver;
170 padding: 0.5em;
171}
172
173div.verseblock div.content {
174 white-space: pre;
175}
176
177div.imageblock div.content { padding-left: 0; }
178div.imageblock img { border: 1px solid silver; }
179span.image img { border-style: none; }
180
181dl {
182 margin-top: 0.8em;
183 margin-bottom: 0.8em;
184}
185dt {
186 margin-top: 0.5em;
187 margin-bottom: 0;
188 font-style: italic;
189}
190dd > *:first-child {
191 margin-top: 0;
192}
193
194ul, ol {
195 list-style-position: outside;
196}
197ol.olist2 {
198 list-style-type: lower-alpha;
199}
200
201div.tableblock > table {
202 border-color: #527bbd;
203 border-width: 3px;
204}
205thead {
206 font-family: sans-serif;
207 font-weight: bold;
208}
209tfoot {
210 font-weight: bold;
211}
212
213div.hlist {
214 margin-top: 0.8em;
215 margin-bottom: 0.8em;
216}
217td.hlist1 {
218 vertical-align: top;
219 font-style: italic;
220 padding-right: 0.8em;
221}
222td.hlist2 {
223 vertical-align: top;
224}
225
226@media print {
227 div#footer-badges { display: none; }
228}
229include::./stylesheets/xhtml11-manpage.css[]
230/* Workarounds for IE6's broken and incomplete CSS2. */
231
232div.sidebar-content {
233 background: #ffffee;
234 border: 1px solid silver;
235 padding: 0.5em;
236}
237div.sidebar-title, div.image-title {
238 font-family: sans-serif;
239 font-weight: bold;
240 margin-top: 0.0em;
241 margin-bottom: 0.5em;
242}
243
244div.listingblock div.content {
245 border: 1px solid silver;
246 background: #f4f4f4;
247 padding: 0.5em;
248}
249
250div.quoteblock-content {
251 padding-left: 2.0em;
252}
253
254div.exampleblock-content {
255 border-left: 2px solid silver;
256 padding-left: 0.5em;
257}
258</style>
259<title>git-rebase(1)</title>
260</head>
261<body>
262<div id="header">
263<h1>
264git-rebase(1) Manual Page
265</h1>
266<h2>NAME</h2>
267<div class="sectionbody">
268<p>git-rebase -
Junio C Hamano6112cad2006-05-02 07:28:06269 Rebase local commits to a new head
Junio C Hamano1a4e8412005-12-27 08:17:23270</p>
271</div>
272</div>
273<h2>SYNOPSIS</h2>
274<div class="sectionbody">
Junio C Hamano97f518c2006-06-22 19:49:35275<p><em>git-rebase</em> [--merge] [--onto &lt;newbase&gt;] &lt;upstream&gt; [&lt;branch&gt;]</p>
Junio C Hamano6959c6c2006-05-17 10:34:11276<p><em>git-rebase</em> --continue | --skip | --abort</p>
Junio C Hamano1a4e8412005-12-27 08:17:23277</div>
278<h2>DESCRIPTION</h2>
279<div class="sectionbody">
Junio C Hamano6112cad2006-05-02 07:28:06280<p>git-rebase replaces &lt;branch&gt; with a new branch of the same name. When
281the --onto option is provided the new branch starts out with a HEAD equal
282to &lt;newbase&gt;, otherwise it is equal to &lt;upstream&gt;. It then attempts to
283create a new commit for each commit from the original &lt;branch&gt; that does
284not exist in the &lt;upstream&gt; branch.</p>
285<p>It is possible that a merge failure will prevent this process from being
286completely automatic. You will have to resolve any such merge failure
Junio C Hamano6959c6c2006-05-17 10:34:11287and run <tt>git rebase --continue</tt>. Another option is to bypass the commit
288that caused the merge failure with <tt>git rebase --skip</tt>. To restore the
289original &lt;branch&gt; and remove the .dotest working files, use the command
290<tt>git rebase --abort</tt> instead.</p>
Junio C Hamano6112cad2006-05-02 07:28:06291<p>Note that if &lt;branch&gt; is not specified on the command line, the currently
292checked out branch is used.</p>
Junio C Hamano7e9f6b72006-02-22 10:44:55293<p>Assume the following history exists and the current branch is "topic":</p>
Junio C Hamano6112cad2006-05-02 07:28:06294<div class="listingblock">
Junio C Hamano7e9f6b72006-02-22 10:44:55295<div class="content">
Junio C Hamano6112cad2006-05-02 07:28:06296<pre><tt> A---B---C topic
297 /
298 D---E---F---G master</tt></pre>
Junio C Hamano7e9f6b72006-02-22 10:44:55299</div></div>
Junio C Hamano2b135272006-03-18 07:45:42300<p>From this point, the result of either of the following commands:</p>
Junio C Hamano7e9f6b72006-02-22 10:44:55301<div class="literalblock">
302<div class="content">
303<pre><tt>git-rebase master
304git-rebase master topic</tt></pre>
305</div></div>
306<p>would be:</p>
Junio C Hamano6112cad2006-05-02 07:28:06307<div class="listingblock">
Junio C Hamano7e9f6b72006-02-22 10:44:55308<div class="content">
Junio C Hamano6112cad2006-05-02 07:28:06309<pre><tt> A'--B'--C' topic
310 /
311 D---E---F---G master</tt></pre>
Junio C Hamano7e9f6b72006-02-22 10:44:55312</div></div>
Junio C Hamano2b135272006-03-18 07:45:42313<p>While, starting from the same point, the result of either of the following
Junio C Hamano7e9f6b72006-02-22 10:44:55314commands:</p>
315<div class="literalblock">
316<div class="content">
317<pre><tt>git-rebase --onto master~1 master
318git-rebase --onto master~1 master topic</tt></pre>
319</div></div>
320<p>would be:</p>
Junio C Hamano6112cad2006-05-02 07:28:06321<div class="listingblock">
Junio C Hamano7e9f6b72006-02-22 10:44:55322<div class="content">
Junio C Hamano6112cad2006-05-02 07:28:06323<pre><tt> A'--B'--C' topic
324 /
325 D---E---F---G master</tt></pre>
Junio C Hamano7e9f6b72006-02-22 10:44:55326</div></div>
Junio C Hamanof02e09f2006-03-27 07:51:03327<p>In case of conflict, git-rebase will stop at the first problematic commit
Junio C Hamano6112cad2006-05-02 07:28:06328and leave conflict markers in the tree. You can use git diff to locate
329the markers (&lt;&lt;&lt;&lt;&lt;&lt;) and make edits to resolve the conflict. For each
330file you edit, you need to tell git that the conflict has been resolved,
331typically this would be done with</p>
Junio C Hamanof02e09f2006-03-27 07:51:03332<div class="literalblock">
333<div class="content">
Junio C Hamano6112cad2006-05-02 07:28:06334<pre><tt>git update-index &lt;filename&gt;</tt></pre>
335</div></div>
336<p>After resolving the conflict manually and updating the index with the
337desired resolution, you can continue the rebasing process with</p>
338<div class="literalblock">
339<div class="content">
340<pre><tt>git rebase --continue</tt></pre>
Junio C Hamanof02e09f2006-03-27 07:51:03341</div></div>
342<p>Alternatively, you can undo the git-rebase with</p>
343<div class="literalblock">
344<div class="content">
Junio C Hamano6112cad2006-05-02 07:28:06345<pre><tt>git rebase --abort</tt></pre>
Junio C Hamanof02e09f2006-03-27 07:51:03346</div></div>
Junio C Hamano1a4e8412005-12-27 08:17:23347</div>
348<h2>OPTIONS</h2>
349<div class="sectionbody">
350<dl>
351<dt>
Junio C Hamano7e9f6b72006-02-22 10:44:55352&lt;newbase&gt;
353</dt>
354<dd>
355<p>
356 Starting point at which to create the new commits. If the
357 --onto option is not specified, the starting point is
358 &lt;upstream&gt;.
359</p>
360</dd>
361<dt>
Junio C Hamano1a4e8412005-12-27 08:17:23362&lt;upstream&gt;
363</dt>
364<dd>
365<p>
366 Upstream branch to compare against.
367</p>
368</dd>
369<dt>
Junio C Hamano2b135272006-03-18 07:45:42370&lt;branch&gt;
Junio C Hamano1a4e8412005-12-27 08:17:23371</dt>
372<dd>
373<p>
374 Working branch; defaults to HEAD.
375</p>
376</dd>
Junio C Hamano6112cad2006-05-02 07:28:06377<dt>
378--continue
379</dt>
380<dd>
381<p>
382 Restart the rebasing process after having resolved a merge conflict.
383</p>
384</dd>
385<dt>
386--abort
387</dt>
388<dd>
389<p>
390 Restore the original branch and abort the rebase operation.
391</p>
392</dd>
Junio C Hamano97f518c2006-06-22 19:49:35393<dt>
394--skip
395</dt>
396<dd>
397<p>
398 Restart the rebasing process by skipping the current patch.
Junio C Hamano97f518c2006-06-22 19:49:35399</p>
400</dd>
401<dt>
402--merge
403</dt>
404<dd>
405<p>
406 Use merging strategies to rebase. When the recursive (default) merge
407 strategy is used, this allows rebase to be aware of renames on the
408 upstream side.
409</p>
410</dd>
411<dt>
412-s &lt;strategy&gt;, --strategy=&lt;strategy&gt;
413</dt>
414<dd>
415<p>
416 Use the given merge strategy; can be supplied more than
417 once to specify them in the order they should be tried.
418 If there is no <tt>-s</tt> option, a built-in list of strategies
419 is used instead (<tt>git-merge-recursive</tt> when merging a single
420 head, <tt>git-merge-octopus</tt> otherwise). This implies --merge.
421</p>
422</dd>
423</dl>
424</div>
425<h2>MERGE STRATEGIES</h2>
426<div class="sectionbody">
427<dl>
428<dt>
429resolve
430</dt>
431<dd>
432<p>
433 This can only resolve two heads (i.e. the current branch
434 and another branch you pulled from) using 3-way merge
435 algorithm. It tries to carefully detect criss-cross
436 merge ambiguities and is considered generally safe and
437 fast.
438</p>
439</dd>
440<dt>
441recursive
442</dt>
443<dd>
444<p>
445 This can only resolve two heads using 3-way merge
446 algorithm. When there are more than one common
447 ancestors that can be used for 3-way merge, it creates a
448 merged tree of the common ancestors and uses that as
449 the reference tree for the 3-way merge. This has been
450 reported to result in fewer merge conflicts without
451 causing mis-merges by tests done on actual merge commits
452 taken from Linux 2.6 kernel development history.
453 Additionally this can detect and handle merges involving
454 renames. This is the default merge strategy when
455 pulling or merging one branch.
456</p>
457</dd>
458<dt>
459octopus
460</dt>
461<dd>
462<p>
463 This resolves more than two-head case, but refuses to do
464 complex merge that needs manual resolution. It is
465 primarily meant to be used for bundling topic branch
466 heads together. This is the default merge strategy when
467 pulling or merging more than one branches.
468</p>
469</dd>
470<dt>
471ours
472</dt>
473<dd>
474<p>
475 This resolves any number of heads, but the result of the
476 merge is always the current branch head. It is meant to
477 be used to supersede old development history of side
478 branches.
479</p>
480</dd>
Junio C Hamano1a4e8412005-12-27 08:17:23481</dl>
482</div>
Junio C Hamano6112cad2006-05-02 07:28:06483<h2>NOTES</h2>
484<div class="sectionbody">
485<p>When you rebase a branch, you are changing its history in a way that
486will cause problems for anyone who already has a copy of the branch
487in their repository and tries to pull updates from you. You should
488understand the implications of using <em>git rebase</em> on a repository that
489you share.</p>
490<p>When the git rebase command is run, it will first execute a "pre-rebase"
491hook if one exists. You can use this hook to do sanity checks and
492reject the rebase if it isn't appropriate. Please see the template
493pre-rebase hook script for an example.</p>
494<p>You must be in the top directory of your project to start (or continue)
495a rebase. Upon completion, &lt;branch&gt; will be the current branch.</p>
496</div>
Junio C Hamano1a4e8412005-12-27 08:17:23497<h2>Author</h2>
498<div class="sectionbody">
499<p>Written by Junio C Hamano &lt;junkio@cox.net&gt;</p>
500</div>
501<h2>Documentation</h2>
502<div class="sectionbody">
503<p>Documentation by Junio C Hamano and the git-list &lt;git@vger.kernel.org&gt;.</p>
504</div>
505<h2>GIT</h2>
506<div class="sectionbody">
507<p>Part of the <a href="git.html">git(7)</a> suite</p>
508</div>
509<div id="footer">
510<div id="footer-text">
Junio C Hamano7ccb9fd2006-07-15 01:38:40511Last updated 15-Jul-2006 01:38:04 UTC
Junio C Hamano1a4e8412005-12-27 08:17:23512</div>
513</div>
514</body>
515</html>