0

We are using gerrit CI, which requires a commit-msg hook which adds a Change-ID to each commit message.

However, sometimes when pulling we get a recursive merge, this shows up in the reflog like this:

767deb5 HEAD@{0}: pull: Merge made by the 'recursive' strategy.

When this happens, we can't push to our gerrit server, and get the following message:

 ! [remote rejected] HEAD -> refs/for/master ([767deb5] missing Change-Id in commit message footer)

It is resolved easily enough by amending the last commit. But this is tedious, and it's frustrating.

How can we avoid this problem? Why does the recursive merge strategy not trigger the commit-msg hook? How can we make it trigger the hook automatically?

Inbar Rose
  • 35,719
  • 22
  • 80
  • 120

1 Answers1

1

The issue is not related with the recursive merge strategy (I think it was just a coincidence). If you want to learn more about recursive merge strategy take a look at this very good text about it.

The issue happens because Git commit-msg hook is not executed for merge commits without conflicts. You will find a very good workaround to this at: https://stackoverflow.com/a/24692818/4653675

Community
  • 1
  • 1
  • Great, that workaround is perfect. I will accept your answer if you quote the contents here for posterity. :) – Inbar Rose Feb 15 '17 at 10:36