Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
685 views
in Technique[技术] by (71.8m points)

git - Gerrit error when Change-Id in commit messages are missing

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 operations:

  1. checkout branch
  2. checkout master
  3. merge branch and fix merging errors
  4. commit
  5. push origin HEAD:refs/for/master

But get error messages on the 5th step:

remote: Resolving deltas:   0% (0/12)

remote: ERROR: missing Change-Id in commit message
...

remote: Change-Id: I55862204ef71f69bc88c79fe2259f7cb8365699a

To ssh://[email protected]:29418/hello_git
 ! [remote rejected] HEAD -> refs/for/master (missing Change-Id in commit message)
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

Check if your commits have Change-Id: ... in their descriptions. Every commit should have them.

If no, use git rebase -i to reword the commit messages and add proper Change-Ids (usually this is a SHA1 of the first version of the reviewed commit).

For the future, you should install commit hook, which automatically adds the required Change-Id.

Execute scp -p -P 29418 username@your_gerrit_address:hooks/commit-msg .git/hooks/ in the repository directory or download them from http://your_gerrit_address/tools/hooks/commit-msg and copy to .git/hooks


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...