I am hard resetting one branch to another. After merging it with the ours
strategy, I try to push through gerrit. I am getting an error like "missing change id". By default, the merge commit does not have a change id. I have tried to download the commit-msg hook for automatic change id. But it does not help in Windows. Any idea how to add change the id in a merge commit?

- 347,512
- 102
- 1,199
- 985

- 566
- 7
- 26
-
Can you add the error message? and the push command. dose the error shown when you try to push to gerrit? – MTZ4 Sep 29 '15 at 06:55
-
check this out: [why does not Gerrit include change id into merge commits](http://stackoverflow.com/a/24692818/1342413) – laplasz Sep 29 '15 at 08:12
-
Possible duplicate of [Why does Gerrit not include the change-id into merge commits?](http://stackoverflow.com/questions/19917025/why-does-gerrit-not-include-the-change-id-into-merge-commits) – Ciro Santilli OurBigBook.com Aug 04 '16 at 13:00
1 Answers
Situation: you have a commit that needs to be pushed to gerrit, but the commit has no change-id and gerrit won't accept it.
Solution:
Download the commit-msg hook from gerrit
$ scp -p -P 29418 TimCastelijns@server.timcastelijns.nl:hooks/commit-msg tims-project/.git/hooks/
Do replace the port number, server address and project name with your own. Also, change the path of
tims-project/.git/hooks/
depending on your current location in the terminal. The hook has to go into<project_dir>/.git/hooks/
.Go to your repo folder and amend the merge commit
$ cd tims-project/ $ git commit --amend
In the editor that pops up when you amend, the current commit and it's commit message are shown. Do nothing here. Simply exit & save the editor. Because of the commit-msg hook which is a post-commit hook, any commit that is made (created or amended) automatically gets assigned a change-id.
push to gerrit
$ git push origin HEAD:refs/for/master
Replace branch and remote with your own if needed.

- 41,901
- 18
- 127
- 145
-
Thank you, it helped. However, Step 1 is NOT required in the context of this question. The problem is not with a general commit, but MERGE COMMIT which does not include change-id. If general commits are working (which appears from the question, and it was also the case for me), step 1 is not needed! Thank you again! – kunal18 Apr 24 '19 at 16:32