The interactive mode of rebase can be used to split commits. Tell the interested parties about it, with a dedicated section in the man page. Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> --- I hope I got the asciidoc markup right... Documentation/git-rebase.txt | 39 ++++++++++++++++++++++++++++++++++++++- 1 files changed, 38 insertions(+), 1 deletions(-) diff --git a/Documentation/git-rebase.txt b/Documentation/git-rebase.txt index a1b6dce..640ea3b 100644 --- a/Documentation/git-rebase.txt +++ b/Documentation/git-rebase.txt @@ -211,7 +211,8 @@ OPTIONS -i, \--interactive:: 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, \--preserve-merges:: Instead of ignoring merges, try to recreate them. This option @@ -325,6 +326,42 @@ sure that the current HEAD is "B", and call $ git rebase -i -p --onto Q O ----------------------------- + +SPLITTING COMMITS +----------------- + +In interactive mode, you can mark commits with the action "edit". However, +this does not necessarily mean that 'git rebase' 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: + +- Start an interactive rebase with 'git rebase -i <commit>^', where + <commit> is the commit you want to split. In fact, any commit range + will do, as long as it contains that commit. + +- Mark the commit you want to split with the action "edit". + +- When it comes to editing that commit, execute 'git reset HEAD^'. The + effect is that the HEAD is rewound by one, and the index follows suit. + However, the working tree stays the same. + +- Now add the changes to the index that you want to have in the first + commit. You can use gitlink:git-add[1] (possibly interactively) and/or + gitlink:git-gui[1] to do that. + +- Commit the now-current index with whatever commit message is appropriate + now. + +- Repeat the last two steps until your working tree is clean. + +- Continue the rebase with 'git rebase --continue'. + +If you are not absolutely sure that the intermediate revisions are +consistent (they compile, pass the testsuite, etc.) you should use +gitlink:git-stash[1] to stash away the not-yet-committed changes +after each commit, test, and amend the commit if fixes are necessary. + + Authors ------ Written by Junio C Hamano <junkio@cox.net> and -- 1.5.3.rc7.18.gc9b59 - To unsubscribe from this list: send the line "unsubscribe git" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html
| Linus Torvalds | Linux 2.6.27-rc8 |
| Greg KH | [patch 00/71] 2.6.26-stable review |
| Dmitry Torokhov | 2.6.27-rc8+ - first impressions |
| jimmy bahuleyan | Re: Hibernation considerations |
git: | |
| Petr Baudis | [FYI][PATCH] Customizing the WinGit installer |
| Jan Hudec | Re: [PATCH] Move all dashed form git commands to libexecdir |
| Jay Soffian | Re: [PATCH] gitweb: Support caching projects list |
| Mark Levedahl | Allowing override of the default "origin" nickname |
| Richard Stallman | Real men don't attack straw men |
| Leon Dippenaar | New tcp stack attack |
| Luca Dell'Oca | Authenticate squid in Active Directory |
| Todd Pytel | IDE or SCSI virtual disks for VMWare image? |
| Jarek Poplawski | Re: [PATCH] pkt_sched: Destroy gen estimators under rtnl_lock(). |
| Matthew Dharm | Re: [RFC] Patch to option HSO driver to the kernel |
| Ingo Molnar | Re: [bug] stuck localhost TCP connections, v2.6.26-rc3+ |
| David Miller | Re: [GIT PULL] [IPV6] COMPAT: Fix SSM applications on 64bit kernels. |
