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

Re: [BUG] - "git commit --amend" commits, when exiting the editor with no changes written

From
Wincent Colaiuta <win@wincent.com>
Date
Feb 2, 2010, 22:06 UTC
Message-ID
<77153A83-158D-4D36-A622-7AA3947C7D52@wincent.com>
In-Reply-To
<76c5b8581002021356m52bb1817k9a4a29da0d4b681d@mail.gmail.com>
El 02/02/2010, a las 22:56, Eugene Sajine escribió:
Show 16 quoted lines
>>
>> As has already been pointed out, an extremely common workflow for  
>> "git
>> commit --amend" is to include additional changes that were  
>> accidentally
>> overlooked  in the initial commit, and no changes are made to the  
>> commit
>> message.
>>
>> Changing the behavior would break that perfectly reasonable,
>> widely-practised workflow, and _that_ would be 100% not ok.
>
> I'm not against that workflow - I'm not forcing anybody to change the
> commit message. The thing I'm talking about is roughly that it should
> NOT treat the result of command ":q" the same way as the command
> ":wq".

Why should Git care about how you exited from your EDITOR? All it should care about is the contents of the commit message, and the exit code of the editor.

Show 7 quoted lines
> For example IF there is a variable somewhere where message is stored:
> For new commit message it is NULL and when commit is ready it is set
> up to "message". We check If it is not empty and not NULL (:wq
> executed),  then we can commit.
> For "prepopulated" messages this variable can be is set to "message"
> from the beginning, so it doesn't matter if you're writing changes or
> not the check will always be true, so we can commit.

I don't understand what change you're asking for, as things already work as you've just described (the "variable" is the file, .git/ COMMIT_EDITMSG).

> If the implementation would be like this, then I would propose to
> clean up this variable after the prepopulated message is populated, so
> it won't use it blindly, but only after you're overwriting the message
> (even if the message is not changed).

Here is where you've lost me. Not sure what you mean here, nor how you're going to maintain the existing behavior for all of the people who have grown used to it over a long, long period of time.

Wincent
Previous: Erik Faye-LundNext: Eugene Sajine
Message 8 of 45 in “[BUG] - "git commit --amend" commits, when exiting the editor with no changes written”
  1. Eugene SajineFeb 2, 2010
  2. Jacob HelwigFeb 2, 2010
  3. Avery PennarunFeb 2, 2010
  4. Eugene SajineFeb 2, 2010
  5. Wincent ColaiutaFeb 2, 2010
  6. Eugene SajineFeb 2, 2010
  7. Erik Faye-LundFeb 2, 2010
  8. Wincent ColaiutaFeb 2, 2010
  9. Eugene SajineFeb 2, 2010
  10. Avery PennarunFeb 2, 2010
  11. Eugene SajineFeb 2, 2010
  12. Johannes SchindelinFeb 2, 2010
  13. Eugene SajineFeb 2, 2010
  14. Avery PennarunFeb 2, 2010
  15. Larry D'AnnaFeb 3, 2010
  16. Jeff KingFeb 3, 2010
  17. Jeff KingFeb 3, 2010
  18. Avery PennarunFeb 3, 2010
  19. Johannes SchindelinFeb 2, 2010
  20. Eugene SajineFeb 2, 2010
  21. Erik Faye-LundFeb 2, 2010
  22. Eugene SajineFeb 2, 2010
  23. Erik Faye-LundFeb 3, 2010
  24. Eugene SajineFeb 3, 2010
  25. SZEDER GáborFeb 3, 2010
  26. Matthieu MoyFeb 3, 2010
  27. aborting rebase -i right at the start, was Re: [BUG] - "git commit --amend" commits, when exiting the editor with no changes writtenJohannes Schindelin, Feb 3, 2010
  28. SZEDER GáborFeb 3, 2010
  29. Eugene SajineFeb 3, 2010
  30. Matthieu MoyFeb 3, 2010
  31. Eugene SajineFeb 3, 2010
  32. Jonathan NiederFeb 3, 2010
  33. Jonathan NiederFeb 3, 2010
  34. Wincent ColaiutaFeb 3, 2010
  35. Eugene SajineFeb 3, 2010
  36. Avery PennarunFeb 3, 2010
  37. Eugene SajineFeb 3, 2010
  38. Avery PennarunFeb 3, 2010
  39. Matthieu MoyFeb 3, 2010
  40. Johannes SchindelinFeb 2, 2010
  41. Eugene SajineFeb 3, 2010
  42. Johannes SchindelinFeb 3, 2010
  43. Paolo BonziniFeb 3, 2010
  44. Junio C HamanoFeb 2, 2010
  45. Avery PennarunFeb 2, 2010

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.