{"thread":{"id":"9725","subject":"[PATCH] rebase -i: mention the option to split commits in the man page","startedAt":"2007-08-31T17:10:21Z","lastAt":"2007-08-31T17:10:21Z","messageCount":1,"participants":["Johannes Schindelin"],"isPatch":true,"patchVersion":1,"patchTotal":null},"messages":[{"id":"52061","messageId":"Pine.LNX.4.64.0708311809510.28586@racer.site","threadId":"9725","inReplyTo":null,"subject":"[PATCH] rebase -i: mention the option to split commits in the man page","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2007-08-31T17:10:21Z","receivedAt":"2007-08-31T17:10:21Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nThe interactive mode of rebase can be used to split commits.  Tell the\ninterested parties about it, with a dedicated section in the man page.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tI hope I got the asciidoc markup right...\n\n Documentation/git-rebase.txt |   39 ++++++++++++++++++++++++++++++++++++++-\n 1 files changed, 38 insertions(+), 1 deletions(-)\n\ndiff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt\nindex a1b6dce..640ea3b 100644\n--- a/Documentation/git-rebase.txt\n+++ b/Documentation/git-rebase.txt\n@@ -211,7 +211,8 @@ OPTIONS\n \n -i, \\--interactive::\n \tMake a list of the commits which are about to be rebased.  Let the\n-\tuser edit that list before rebasing.\n+\tuser edit that list before rebasing.  This mode can also be used to\n+\tsplit commits (see SPLITTING COMMITS below).\n \n -p, \\--preserve-merges::\n \tInstead of ignoring merges, try to recreate them.  This option\n@@ -325,6 +326,42 @@ sure that the current HEAD is \"B\", and call\n $ git rebase -i -p --onto Q O\n -----------------------------\n \n+\n+SPLITTING COMMITS\n+-----------------\n+\n+In interactive mode, you can mark commits with the action \"edit\".  However,\n+this does not necessarily mean that 'git rebase' expects the result of this\n+edit to be exactly one commit.  Indeed, you can undo the commit, or you can\n+add other commits.  This can be used to split a commit into two:\n+\n+- Start an interactive rebase with 'git rebase -i <commit>^', where\n+  <commit> is the commit you want to split.  In fact, any commit range\n+  will do, as long as it contains that commit.\n+\n+- Mark the commit you want to split with the action \"edit\".\n+\n+- When it comes to editing that commit, execute 'git reset HEAD^'.  The\n+  effect is that the HEAD is rewound by one, and the index follows suit.\n+  However, the working tree stays the same.\n+\n+- Now add the changes to the index that you want to have in the first\n+  commit.  You can use gitlink:git-add[1] (possibly interactively) and/or\n+  gitlink:git-gui[1] to do that.\n+\n+- Commit the now-current index with whatever commit message is appropriate\n+  now.\n+\n+- Repeat the last two steps until your working tree is clean.\n+\n+- Continue the rebase with 'git rebase --continue'.\n+\n+If you are not absolutely sure that the intermediate revisions are\n+consistent (they compile, pass the testsuite, etc.) you should use\n+gitlink:git-stash[1] to stash away the not-yet-committed changes\n+after each commit, test, and amend the commit if fixes are necessary.\n+\n+\n Authors\n ------\n Written by Junio C Hamano <junkio@cox.net> and\n-- \n1.5.3.rc7.18.gc9b59\n"}]}