author | Junio C Hamano <gitster@pobox.com> | |
Mon, 21 Jun 2010 13:02:49 +0000 (06:02 -0700) | ||
committer | Junio C Hamano <gitster@pobox.com> | |
Mon, 21 Jun 2010 13:02:49 +0000 (06:02 -0700) |
* jk/maint-advice-empty-amend:
commit: give advice on empty amend
commit: give advice on empty amend
builtin/commit.c | patch | blob | history |
diff --git a/builtin/commit.c b/builtin/commit.c
index 511d4901d55b5812968d48db89ee2b250e86ddb3..5e4f0f33b7335224c3ab01c5e2421cc98e80f5a9 100644 (file)
--- a/builtin/commit.c
+++ b/builtin/commit.c
"\n"
" git commit --amend --author='Your Name <you@example.com>'\n";
+static const char empty_amend_advice[] =
+"You asked to amend the most recent commit, but doing so would make\n"
+"it empty. You can repeat your command with --allow-empty, or you can\n"
+"remove the commit entirely with \"git reset HEAD^\".\n";
+
static unsigned char head_sha1[20];
static char *use_message_buffer;
if (!commitable && !in_merge && !allow_empty &&
!(amend && is_a_merge(head_sha1))) {
run_status(stdout, index_file, prefix, 0, s);
+ if (amend)
+ fputs(empty_amend_advice, stderr);
return 0;
}