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

No MERGE_HEAD available in pre-merge-commit hook

From
WSWannes Sels <wannes.sels@gmail.com>
Date
Apr 25, 2022, 13:50 UTC
Message-ID
<CAK7pLR1Se_woAr6ntUvka1Qfb_WBen5tXw7=Ybx0cPQrHM-X8w@mail.gmail.com>

The MERGE_HEAD ref is not available in the pre-merge-commit hook, but it is available in subsequent hooks prepare-commit-msg and commit-msg

From https://github.com/git/git/blob/master/builtin/merge.c#L843 : in prepare_to_commit() the call to write_merge_heads() is after run_commit_hook("pre-merge-commit")

Can the write_merge_heads() call be moved up? At first glance it doesn't look like it would break anything.

Message 1 of 1 in “No MERGE_HEAD available in pre-merge-commit hook”
  1. Wannes SelsApr 25, 2022

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.