I am hard resetting one branch to another. After merging it with the
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.
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
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.