git.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: "Ævar Arnfjörð Bjarmason" <avarab@gmail.com>
To: "Jan Krüger" <jk@jk.gs>
Cc: Peter Krefting <peter@softwolves.pp.se>,
	Git Mailing List <git@vger.kernel.org>
Subject: Re: Recovering from commit --amend in rebase --interactive
Date: Tue, 1 Jun 2010 15:25:18 +0000	[thread overview]
Message-ID: <AANLkTinNpIjirZQL1lBi3t4i6_utCIUMuXc8q2gSJvmO@mail.gmail.com> (raw)
In-Reply-To: <20100601115755.04ff4a0d@jk.gs>

On Tue, Jun 1, 2010 at 09:57, Jan Krüger <jk@jk.gs> wrote:
> Peter Krefting <peter@softwolves.pp.se> wrote:
>
>> Last time this happened to me, I *did* notice my mistake as I entered
>> the editor, since it came up with the previous commit's message.
>> However, as the commit message file was in a good shape, I found no
>> way to break out of the amend.
>
> It might be easy to miss, but it's there, right in the editor:
>
> # Please enter the commit message for your changes. Lines starting
> # with '#' will be ignored, and *an empty message aborts the commit*.
> (Emphasis added)
>
> In general, it might be helpful to warn very loudly upon doing a commit
> --amend after fixing conflicts, but an implementation would probably be
> ugly and for all I know, there might be people who frequently cause
> conflicts while amending; those guys would probably be quite annoyed at
> such a warning.

I've also introduced the error Peter describes into my history because
I wasn't careful. That required some splitting / reflog fixes later.

Perhaps the best way to solve this would be to change the content of
COMMIT_EDITMSG in cases like these so it gives you an explicit warning
about what you're about to do.

We already do this for merges, from builtin/commit.c:

		if (in_merge)
			fprintf(fp,
				"#\n"
				"# It looks like you may be committing a MERGE.\n"
				"# If this is not correct, please remove the file\n"
				"#	%s\n"
				"# and try again.\n"
				"#\n",
				git_path("MERGE_HEAD"));

		fprintf(fp,
			"\n"
			"# Please enter the commit message for your changes.");

  reply	other threads:[~2010-06-01 15:25 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-06-01  9:27 Recovering from commit --amend in rebase --interactive Peter Krefting
2010-06-01  9:48 ` Boaz Harrosh
2010-06-01 10:40   ` Peter Krefting
2010-06-01  9:57 ` Jan Krüger
2010-06-01 15:25   ` Ævar Arnfjörð Bjarmason [this message]
2010-06-02 23:37     ` Junio C Hamano
2010-06-03  5:54       ` Ævar Arnfjörð Bjarmason
2010-06-01 15:07 ` Gabriel Filion

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=AANLkTinNpIjirZQL1lBi3t4i6_utCIUMuXc8q2gSJvmO@mail.gmail.com \
    --to=avarab@gmail.com \
    --cc=git@vger.kernel.org \
    --cc=jk@jk.gs \
    --cc=peter@softwolves.pp.se \
    /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).