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

Re: Log messages beginning # and git rebase -i

From
EAEd Avis <eda@waniasset.com>
Date
Jul 28, 2015, 16:40 UTC
Message-ID
<loom.20150728T183310-319@post.gmane.org>
In-Reply-To
<xmqqr3nsfdmw.fsf@gitster.dls.corp.google.com>
I was considering this case:
- git commit -a '-m# characters are now handled OK'
- hack, hack
- git commit -a '-mWhoops, fixed last commit'
- run git-rebase -i
- squash the second commit into the first
- when prompted for the log message for the combined change,
  delete the "Whoops, fixed last commit" line but leave the first line

That will accidentally lose the first log message, assuming commentChar=#. git-rebase -i should be a bit friendlier and not bring up an editing window where the log message ends up being one of the comments.

I suggested it could munge the message with an extra space character, but I agree that is a bit unpleasant. Perhaps better would be

   % git-rebase -i
   error: commit abcde has log message beginning with '#', which is the
          current setting of commentChar.  This means that the interactive
          editing of the log message will not work.  Please set commentChar
          to some other value (such as 'auto') in your git configuration
          to be able to rebase interactively.

The current behaviour is a bit of a trap for the unwary, and anyway it leaves no way to specify keeping the existing log message (which begins #).

-- 
Ed Avis <eda@waniasset.com>
Previous: Junio C HamanoNext: Matthieu Moy
Message 7 of 18 in “Log messages beginning # and git rebase -i”
  1. Ed AvisJul 27, 2015
  2. Eric SunshineJul 27, 2015
  3. Duy NguyenJul 28, 2015
  4. Ed AvisJul 28, 2015
  5. Matthieu MoyJul 28, 2015
  6. Junio C HamanoJul 28, 2015
  7. Ed AvisJul 28, 2015
  8. Matthieu MoyJul 28, 2015
  9. Junio C HamanoJul 28, 2015
  10. Matthieu MoyJul 29, 2015
  11. Ed AvisJul 29, 2015
  12. allow commentChars in commit messagesCorentin BOMPARD, Apr 22, 2019
  13. Duy NguyenJul 29, 2015
  14. Matthieu MoyJul 29, 2015
  15. Duy NguyenJul 29, 2015
  16. Junio C HamanoJul 29, 2015
  17. Matthieu MoyJul 29, 2015
  18. Junio C HamanoJul 29, 2015

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.