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

Re: [PATCH] Teach git-commit about commit message templates.

From
Steven Grimm <koreth@midwinter.com>
Date
Jul 24, 2007, 12:01 UTC
Message-ID
<46A5EA2D.1030707@midwinter.com>
In-Reply-To
<7vfy3fkpr8.fsf@assigned-by-dhcp.cox.net>
Junio C Hamano wrote:
Show 5 quoted lines
> Offhand, an "interesting" side effect of the above I can see is
> that you will cry "wolf" if the only thing the user did is to
> add his own Signed-off-by: line ;-)  But that is sane in the
> context of coming up with totally new commit log message.
>   
Yes, that is intentional -- the existing git-commit code wasn't treating 
Signed-off-by: as content when it checked for a commit message, so I 
wanted to preserve that behavior.
Show 7 quoted lines
> I am more worried about how this should interact with cases
> where you usually do not start the log message from scratch.
> For example, are there cases / policies where being able to use
> templates to leave comments on merge commits are needed?
> Squash-commits?  Perhaps "apply this template but only when you
> have hand resolved a conflicting merges"?
>   

Those are all valid cases. They also happen to be ones that are not personally useful to me; none of the stuff in my company's commit template would really apply to merges. I'm happy to do it if you think those cases need to be handled before this can go in, but given there's at least one user out there who doesn't need those things, I wonder if this makes more sense to hold off on until someone actually asks for it.

> Or even the case of amending a commit made by somebody else,
> without changing the tree contents, in order to make the commit
> log message to conform to the company standard?
>   

It's not clear to me that I can do anything useful in that case, given that there's no way to tell in what way the commit message needs to be fixed up. If it's a case of, "This engineer committed without using the template at all," then I can see an argument for loading the template above / below the existing comment, but IMO a more common case will be something like, "The format is right, but the bug ID isn't filled in or is incorrect," in which case any template I supply would be useless and annoying.

Is your hunch about the common case different than mine? Again, I can go address this if it'll actually be useful. Maybe by always including the template if the command-line option is used, but skipping it in these cases if the config option is used? Or something like that? (On the other hand, if you have to specify the template on the command line, maybe it's easier to just load it into the editor as needed.)

-Steve
Previous: Junio C HamanoNext: Junio C Hamano
Message 8 of 11 in “Teach git-commit about commit message templates.”
  1. Teach git-commit about commit message templates.Steven Grimm, Jul 23, 2007
  2. Johannes SchindelinJul 23, 2007
  3. Steven GrimmJul 23, 2007
  4. Johannes SchindelinJul 23, 2007
  5. Steven GrimmJul 23, 2007
  6. Johannes SchindelinJul 23, 2007
  7. Junio C HamanoJul 23, 2007
  8. Steven GrimmJul 24, 2007
  9. Junio C HamanoJul 24, 2007
  10. Steven GrimmJul 25, 2007
  11. Junio C HamanoJul 25, 2007

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.