]> git.ipfire.org Git - thirdparty/git.git/commit - builtin/commit.c
commit: give advice on empty amend
authorJeff King <peff@peff.net>
Mon, 7 Jun 2010 00:41:46 +0000 (20:41 -0400)
committerJunio C Hamano <gitster@pobox.com>
Fri, 11 Jun 2010 15:55:57 +0000 (08:55 -0700)
commitf197ed2fbeb2868c3514ad35bf986a3aa60285f0
treede39fff1a675df503380579b4a178dc0003a63d5
parent2543d9b609d158f611e317738644e67cacac6b9a
commit: give advice on empty amend

We generally disallow empty commits with "git commit". The
output produced by the wt_status functions is generally
sufficient to explain what happened.

With --amend commits, however, things are a little more
confusing. We would create an empty commit not if you
actually have staged changes _now_, but if your staged
changes match HEAD^. In this case, it is not immediately
obvious why "git commit" claims no changes, but "git status"
does not. Furthermore, we should point the user in the
direction of git reset, which would eliminate the empty
commit entirely.

Signed-off-by: Jeff King <peff@peff.net>
Signed-off-by: Junio C Hamano <gitster@pobox.com>
builtin/commit.c