git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Eugene Sajine <euguess@gmail.com>
To: Avery Pennarun <apenwarr@gmail.com>
Cc: Jacob Helwig <jacob.helwig@gmail.com>,
	git@vger.kernel.org, Eugene Sajine <euguess@gmail.com>
Subject: Re: [BUG] - "git commit --amend" commits, when exiting the editor  with no changes written
Date: Tue, 2 Feb 2010 15:47:45 -0500	[thread overview]
Message-ID: <76c5b8581002021247j6df8f609ld9e5d87a060a5423@mail.gmail.com> (raw)
In-Reply-To: <32541b131002021227o1ec9f369w6096e85382857b8a@mail.gmail.com>

On Tue, Feb 2, 2010 at 3:27 PM, Avery Pennarun <apenwarr@gmail.com> wrote:
> On Tue, Feb 2, 2010 at 3:14 PM, Jacob Helwig <jacob.helwig@gmail.com> wrote:
>> On Tue, Feb 2, 2010 at 12:07, Eugene Sajine <euguess@gmail.com> wrote:
>>> When git commit --amend is executed it fires up vi so i can change the
>>> commit message. If I have something staged, then when I'm exiting vi
>>> using :q (without doing/writing any changes), it still commits
>>> everything staged with old message.
>>>
>>> I believe it should actually abort amending and return to the state
>>> before the "git commit --amend" was issued.
>>
>> I don't think this is actually the right way to go.  A _very_ common
>> use case for "commit --amend" is to add things to the previous commit,
>> without changing the commit message at all.  Yes, you can avoid having
>> to fire up the editor at all in this case, but it's still a perfectly
>> valid thing to want to do.
>
> I agree and I do this all the time. However, I've also done it
> accidentally before I learned the "remove the commit message and save"
> trick.
>
> Perhaps what's really missing is more documentation of how to
> "unamend" if you change your mind :)  I happen to know about "git
> reset HEAD@{1}" but it's not terribly obvious.
>
> Avery
>

Well, i understand this logic but it seems to me that the issue is a
little bit deeper than that.
I just realized that the "rebase -i" is doing the same thing.

If you're just exiting the vi using :q without writing changes it will
perform rebase! I'm 100% sure it is not OK.

So, it seems that it will do that every time it has some
*prepopulated* message in the editor, so it doesn't understand when
changes are written and when they are not.

I believe all those actions should be treated exactly the same way as
the commit itself. If I'm writing/saving changes - it is good to go.
If not - abort.
I.e. the message can be prepopulated in the editor, but it should be
the same state as when you create a new message for commit, i.e. git
should not know anything about that message.

Thanks,
Eugene

  reply	other threads:[~2010-02-02 20:48 UTC|newest]

Thread overview: 45+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-02-02 20:07 [BUG] - "git commit --amend" commits, when exiting the editor with no changes written Eugene Sajine
2010-02-02 20:14 ` Jacob Helwig
2010-02-02 20:27   ` Avery Pennarun
2010-02-02 20:47     ` Eugene Sajine [this message]
2010-02-02 20:58       ` Wincent Colaiuta
2010-02-02 21:56         ` Eugene Sajine
2010-02-02 22:03           ` Erik Faye-Lund
2010-02-02 22:06           ` Wincent Colaiuta
2010-02-02 22:31             ` Eugene Sajine
2010-02-02 22:35               ` Avery Pennarun
2010-02-02 23:02                 ` Eugene Sajine
2010-02-02 23:15                   ` Johannes Schindelin
2010-02-02 23:27                     ` Eugene Sajine
2010-02-02 23:40                   ` Avery Pennarun
2010-02-03  6:15                     ` Larry D'Anna
2010-02-03  9:31                       ` Jeff King
2010-02-03 10:15                         ` Jeff King
2010-02-03 18:19                         ` Avery Pennarun
2010-02-02 23:00               ` Johannes Schindelin
2010-02-02 23:34                 ` Eugene Sajine
2010-02-02 23:40                   ` Erik Faye-Lund
2010-02-02 23:48                     ` Eugene Sajine
2010-02-03  0:16                       ` Erik Faye-Lund
2010-02-03  0:55                         ` Eugene Sajine
2010-02-03  1:59                           ` SZEDER Gábor
2010-02-03  7:34                             ` Matthieu Moy
2010-02-03  9:08                               ` aborting rebase -i right at the start, was " Johannes Schindelin
2010-02-03  9:41                                 ` SZEDER Gábor
2010-02-03 16:02                                   ` Eugene Sajine
2010-02-03  7:31                       ` Matthieu Moy
2010-02-03 15:45                         ` Eugene Sajine
2010-02-03 17:51                           ` Jonathan Nieder
2010-02-03 17:53                             ` Jonathan Nieder
2010-02-03 18:21                           ` Wincent Colaiuta
2010-02-03 18:49                             ` Eugene Sajine
2010-02-03 18:57                               ` Avery Pennarun
2010-02-03 19:27                                 ` Eugene Sajine
2010-02-03 19:54                                   ` Avery Pennarun
2010-02-03 18:47                           ` Matthieu Moy
2010-02-02 23:58                   ` Johannes Schindelin
2010-02-03  0:09                     ` Eugene Sajine
2010-02-03  9:04                       ` Johannes Schindelin
2010-02-03  9:46                       ` Paolo Bonzini
2010-02-02 23:44                 ` Junio C Hamano
2010-02-02 21:18       ` Avery Pennarun

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=76c5b8581002021247j6df8f609ld9e5d87a060a5423@mail.gmail.com \
    --to=euguess@gmail.com \
    --cc=apenwarr@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jacob.helwig@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).