git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
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: Sat, 11 Apr 2009 09:11:12 +0800	[thread overview]
Message-ID: <46dff0320904101811g3b5dcc8ag195d40005b181c52@mail.gmail.com> (raw)
In-Reply-To: <alpine.DEB.1.00.0904102009440.10279@pacific.mpi-cbg.de>

On Sat, Apr 11, 2009 at 2:10 AM, Johannes Schindelin
<Johannes.Schindelin@gmx.de> wrote:
> Hi,
>
> On Fri, 10 Apr 2009, Ping Yin wrote:
>
>> On Thu, Apr 9, 2009 at 10:00 AM, Ping Yin <pkufranky@gmail.com> wrote:
>> > 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)
>> >
>>
>> How about this?
>>  'add --edit=patch' to edit the patch and "add --edit=index" to edit the index
>
> As others have mentioned, there _is_ a reason we have a working directory.
> Please understand this as a "I do not like the idea of editing the index
> directly at all".
>

When doing "add --edit" to edit the patch, do you work on the working
directory? I think they are just different ways to change the index?

  parent reply	other threads:[~2009-04-11  1:12 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
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 [this message]
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=46dff0320904101811g3b5dcc8ag195d40005b181c52@mail.gmail.com \
    --to=pkufranky@gmail.com \
    --cc=Johannes.Schindelin@gmx.de \
    --cc=git@vger.kernel.org \
    --cc=gitster@pobox.com \
    --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).