Re: amend warnings with no changes staged
- From
Junio C Hamano <gitster@pobox.com>
- Date
- Aug 6, 2019, 19:11 UTC
- Message-ID
- <xmqqblx2jeh2.fsf@gitster-ct.c.googlers.com>
- In-Reply-To
- <20190806041911.GA9243@sigill.intra.peff.net>
Jeff King <peff@peff.net> writes:
Show 11 quoted lines
> git commit -m 'buggy commit' > echo fix >>file.c > git commit --amend ;# oops, should have been "-a" > git push > > But perhaps that gets to the heart of the matter. Could we perhaps be > providing a more detailed summary of what happened for an --amend? I.e., > to summarize _both_ sets of changes (and if one set is empty, say so)? > ... > judgement about whether it's an error, since it may well be that you > were simply rewording the commit message).
Perhaps "git range-diff HEAD@{1}...HEAD" being an empty is a sign that either the user intentionally or accidentally did not do anything other than "touch"ing the commit.
"git commit --amend --[no-]range-diff" that shows what you changed with the amending may be an interesting possibility; I am not yet ready to seriously encourage anybody to explore it, though, because "git diff HEAD@{1}" is much easier to see what code got changed, but one (and probably only) downside is that it does not cover the change in the log message.