git/list[1] front-page[2] threads[3] people[4] search[5] about
 

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.

Previous: Jeff KingNext: Jeff King
Message 12 of 13 in “amend warnings with no changes staged”
  1. Lukas GrossAug 6, 2019
  2. Jonathan NiederAug 6, 2019
  3. Lukas GrossAug 6, 2019
  4. Jonathan NiederAug 6, 2019
  5. Jonathan NiederAug 6, 2019
  6. Junio C HamanoAug 6, 2019
  7. Jonathan NiederAug 6, 2019
  8. Junio C HamanoAug 6, 2019
  9. Junio C HamanoAug 6, 2019
  10. Phillip WoodAug 6, 2019
  11. Jeff KingAug 6, 2019
  12. Junio C HamanoAug 6, 2019
  13. Jeff KingAug 8, 2019

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.