From: Ping Yin <pkufranky@gmail.com>
To: Johannes Schindelin <johannes.schindelin@gmx.de>
Cc: git@vger.kernel.org, gitster@pobox.com,
Sverre Rabbelier <srabbelier@gmail.com>
Subject: Re: [PATCH] git-add: introduce --edit (to edit the diff vs. the index)
Date: Thu, 9 Apr 2009 10:00:25 +0800 [thread overview]
Message-ID: <46dff0320904081900n7bff2280rc49315e3db427919@mail.gmail.com> (raw)
In-Reply-To: <61c07126e28aba0a36730da06112bd2d16eabc1b.1239225986u.git.johannes.schindelin@gmx.de>
On Thu, Apr 9, 2009 at 5:30 AM, Johannes Schindelin
<johannes.schindelin@gmx.de> wrote:
> With "git add -e [<files>]", Git will fire up an editor with the current
> diff relative to the index (i.e. what you would get with "git diff
> [<files>]").
>
> 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 <johannes.schindelin@gmx.de>
> ---
>
> 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)
next prev parent reply other threads:[~2009-04-09 2:02 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <cover.1239225986u.git.johannes.schindelin@gmx.de>
2009-04-08 21:30 ` [PATCH] git-add: introduce --edit (to edit the diff vs. the index) Johannes Schindelin
2009-04-08 21:32 ` Sverre Rabbelier
2009-04-09 2:00 ` Ping Yin [this message]
2009-04-10 1:43 ` Ping Yin
2009-04-10 2:03 ` Ping Yin
2009-04-10 18:10 ` Johannes Schindelin
2009-04-10 18:59 ` Sverre Rabbelier
2009-04-13 16:19 ` Johannes Schindelin
2009-04-13 16:59 ` Sverre Rabbelier
2009-04-11 1:11 ` Ping Yin
2009-04-13 16:21 ` Johannes Schindelin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=46dff0320904081900n7bff2280rc49315e3db427919@mail.gmail.com \
--to=pkufranky@gmail.com \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=johannes.schindelin@gmx.de \
--cc=srabbelier@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).