I set up a branch in the remote repository and made some commits on that branch. Now I want to merge the remote branch to the remote master.
Basically follows are my
If you need to add Change-Id to multiple commits, you can download the hook from your Gerrit server and run these commands to add the Change-Ids to all commits that need them at once. The example below fixes all commits on your current branch that have not yet been pushed to the upstream branch.
tmp=$(mktemp)
hook=$(readlink -f $(git rev-parse --git-dir))/hooks/commit-msg
git filter-branch -f --msg-filter "cat > $tmp; \"$hook\" $tmp; cat $tmp" @{u}..HEAD
It is because Gerrit is configured to require Change-Id in the commit messages.
http://gerrit.googlecode.com/svn-history/r6114/documentation/2.1.7/error-missing-changeid.html
You have to change the messages of every commit that you are pushing to include the change id ( using git filter-branch
) and only then push.
This can also happen if you have this restriction:
Please enter the commit message for your changes. Lines starting with '#' will be ignored, and an empty message aborts the commit.
and you do like me: write a commit message starting with "#" .....
I had the same error, but I already had the commit-msg
and did the rebase
and everything. Very silly mistake though :D
We solved this issue this morning by re-cloning repository and re-applying changes. This is the simplest way to re-sync your local copy with Gerrit. As always we created a backup first.
Although there are a number of other wildly complicated solutions, its often advantageous to take a simple approach to avoid making things worse.
You might be an admin doing a one-off push directly into refs/changes/<change_number>
.
For example, once a commit without Change-Id landed into Subversion, you pull it out of Subversion using git-svn, and you'd like to archive it as a Gerrit patchset into a Gerrit change.
If so, you can go to project settings page (http://[installation-path]/#/admin/projects/[project-id]) and temporarily change "Require Change-Id in commit message" value to False.
Don't forget to afterwards change it back to Inherit or True!
Check your git repo before committing
gitrepo/.git/hooks/commit-msg
if this file is not present in that location then you will get this error "missing Change-Id in commit message" .
To solve this just copy paste the commit hook in .git folder.