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

How do I control the automated commit message on a merge?

From
MFMarvin Fraeman <marvin.fraeman@gmail.com>
Date
Jun 3, 2008, 21:55 UTC
Message-ID
<bd2cb52a0806031455r151303achf0424b5320bf2f07@mail.gmail.com>

I am using git-svn. The SVN repository I'm dealing with has a standard comment convention I must follow. It is a simple static string of information that must appear on the first line of the commit message. Everything else can be free-form.

I figured out how to add a commit template to my gitconfig file. So for regular commits, I think I'm fine. But when Git does a merge (no conflicts), it auto-generates a commit message like:

        Merge branch 'master' of  /path/to/other/repo

How can I change this so my required string gets written at the beginning of the commit message. I played with the commit-msg and prepare-commit-msg hooks, but it didn't seem to get triggered in the merge case.

Also, having the prepare-commit-msg hook add text had the side-effect that in my normal commits, the message was always accepted, even when I wanted to abort (vi using :q!). In case I ever do need to use prepare-commit-msg, is there a way I can use it where abort still can work?

Thank you
Next: Johannes Schindelin
Message 1 of 4 in “How do I control the automated commit message on a merge?”
  1. Marvin FraemanJun 3, 2008
  2. Johannes SchindelinJun 3, 2008
  3. Marvin FraemanJun 4, 2008
  4. Stephan BeyerJun 4, 2008

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.