summaryrefslogtreecommitdiffstats
path: root/git-rebase.html
diff options
context:
space:
mode:
authorJunio C Hamano <junio@hera.kernel.org>2007-09-01 11:17:39 +0000
committerJunio C Hamano <junio@hera.kernel.org>2007-09-01 11:17:39 +0000
commitdbb64591ddf30b577662e7021a39b24b3fac6177 (patch)
tree0338b6792415ac826f6b2da8d79f2726acf0a0aa /git-rebase.html
parent21e7f9c0020a4f8aa39715acfabba4b5419f6bd4 (diff)
downloadgit-htmldocs-dbb64591ddf30b577662e7021a39b24b3fac6177.tar.gz
Autogenerated HTML docs for v1.5.3-rc7-30-g947ad2
Diffstat (limited to 'git-rebase.html')
-rw-r--r--git-rebase.html60
1 files changed, 58 insertions, 2 deletions
diff --git a/git-rebase.html b/git-rebase.html
index 88f4404f3..515396b71 100644
--- a/git-rebase.html
+++ b/git-rebase.html
@@ -515,7 +515,8 @@ desired resolution, you can continue the rebasing process with</p>
<dd>
<p>
Make a list of the commits which are about to be rebased. Let the
- user edit that list before rebasing.
+ user edit that list before rebasing. This mode can also be used to
+ split commits (see SPLITTING COMMITS below).
</p>
</dd>
<dt>
@@ -729,6 +730,61 @@ sure that the current HEAD is "B", and call</p>
<pre><tt>$ git rebase -i -p --onto Q O</tt></pre>
</div></div>
</div>
+<h2>SPLITTING COMMITS</h2>
+<div class="sectionbody">
+<p>In interactive mode, you can mark commits with the action "edit". However,
+this does not necessarily mean that <em>git rebase</em> expects the result of this
+edit to be exactly one commit. Indeed, you can undo the commit, or you can
+add other commits. This can be used to split a commit into two:</p>
+<ul>
+<li>
+<p>
+Start an interactive rebase with <em>git rebase -i &lt;commit&gt;^</em>, where
+ &lt;commit&gt; is the commit you want to split. In fact, any commit range
+ will do, as long as it contains that commit.
+</p>
+</li>
+<li>
+<p>
+Mark the commit you want to split with the action "edit".
+</p>
+</li>
+<li>
+<p>
+When it comes to editing that commit, execute <em>git reset HEAD^</em>. The
+ effect is that the HEAD is rewound by one, and the index follows suit.
+ However, the working tree stays the same.
+</p>
+</li>
+<li>
+<p>
+Now add the changes to the index that you want to have in the first
+ commit. You can use <a href="git-add.html">git-add(1)</a> (possibly interactively) and/or
+ <a href="git-gui.html">git-gui(1)</a> to do that.
+</p>
+</li>
+<li>
+<p>
+Commit the now-current index with whatever commit message is appropriate
+ now.
+</p>
+</li>
+<li>
+<p>
+Repeat the last two steps until your working tree is clean.
+</p>
+</li>
+<li>
+<p>
+Continue the rebase with <em>git rebase --continue</em>.
+</p>
+</li>
+</ul>
+<p>If you are not absolutely sure that the intermediate revisions are
+consistent (they compile, pass the testsuite, etc.) you should use
+<a href="git-stash.html">git-stash(1)</a> to stash away the not-yet-committed changes
+after each commit, test, and amend the commit if fixes are necessary.</p>
+</div>
<h2>Authors</h2>
<div class="sectionbody">
<p>Written by Junio C Hamano &lt;junkio@cox.net&gt; and
@@ -744,7 +800,7 @@ Johannes E. Schindelin &lt;johannes.schindelin@gmx.de&gt;</p>
</div>
<div id="footer">
<div id="footer-text">
-Last updated 17-Aug-2007 07:47:32 UTC
+Last updated 01-Sep-2007 11:16:26 UTC
</div>
</div>
</body>