From: Ping Yin Date: Fri, 10 Apr 2009 01:43:59 GMT Subject: Re: [PATCH] git-add: introduce --edit (to edit the diff vs. the index) Message-ID: <46dff0320904091843p3e034647j3c78506b4d0c2b4@mail.gmail.com> In-Reply-To: <46dff0320904081900n7bff2280rc49315e3db427919@mail.gmail.com> On Thu, Apr 9, 2009 at 10:00 AM, Ping Yin wrote: > On Thu, Apr 9, 2009 at 5:30 AM, Johannes Schindelin > wrote: >> With "git add -e []", Git will fire up an editor with the current >> diff relative to the index (i.e. what you would get with "git diff >> []"). >> >> Now you can edit the patch as much as you like, including adding/removing >> lines, editing the text, whatever.  Make sure, though, that the first >> character of the hunk lines is still a space, a plus or a minus. >> >> After you closed the editor, Git will adjust the line counts of the hunks >> if necessary, thanks to the --recount option of apply, and commit the >> patch.  Except if you deleted everything, in which case nothing happens >> (for obvious reasons). >> >> Signed-off-by: Johannes Schindelin >> --- >> >>        I actually promised myself not to resend this patch, but a >>        certain guy who has a hat now asked for it. >> > > I am that guy :-). Thanks. Sometimes "add -e" is more useful than "add > -p" since i can see the full context when editing the patch. However, > sometimes the ability to edit the index directly is even more useful. > For example, if it's a big change (or rewritten), it is hard to edit > the patch instead of the index (in diff mode with the worktree file > side by side). I even encounter a case that i can't beat the patch > into a shape i want when using 'add -p'  ( it will fail to apply) > How about this? 'add --edit=patch' to edit the patch and "add --edit=index" to edit the index