# No MERGE_HEAD available in pre-merge-commit hook

1 messages from 2022-04-25 to 2022-04-25. Participants: Wannes Sels.
Thread: https://gitlist.dev/t/57791

## Wannes Sels, 2022-04-25 13:50

Subject: No MERGE_HEAD available in pre-merge-commit hook
Message-ID: <CAK7pLR1Se_woAr6ntUvka1Qfb_WBen5tXw7=Ybx0cPQrHM-X8w@mail.gmail.com>
URL: https://gitlist.dev/e/CAK7pLR1Se_woAr6ntUvka1Qfb_WBen5tXw7%3DYbx0cPQrHM-X8w%40mail.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.

```
