当提交消息中的 Change-Id 丢失时 Gerrit 错误 [英] 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.
我的操作基本如下:
- 结帐分行
- 收银员
- 合并分支并修复合并错误
- 提交
- push origin HEAD:refs/for/master
但是在第 5 步得到错误信息:
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://prc@test.gerrit.xxx.com:29418/hello_git
! [remote rejected] HEAD -> refs/for/master (missing Change-Id in commit message)
推荐答案
检查您的提交是否在其描述中包含 Change-Id: ...
.每个提交都应该有它们.
Check if your commits have Change-Id: ...
in their descriptions. Every commit should have them.
如果不是,请使用 git rebase -i
改写提交消息并添加适当的 Change-Ids(通常这是审查提交的第一个版本的 SHA1).
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).
对于未来,你应该安装 commit hook,它会自动添加所需的 Change-Id.
For the future, you should install commit hook, which automatically adds the required Change-Id.
在存储库目录中执行 scp -p -P 29418 username@your_gerrit_address:hooks/commit-msg .git/hooks/
或从http://your_gerrit_address/tools/hooks/commit-msg
并复制到 .git/hooks
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
这篇关于当提交消息中的 Change-Id 丢失时 Gerrit 错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!