Git提交问题

时间:2014-07-08 07:10:15

标签: git gerrit

我正在使用git来提交我的分支。 我有这个问题推上git:

$ git push origin HEAD:refs/for/master
Counting objects: 117, done.
Delta compression using up to 2 threads.
Compressing objects: 100% (29/29), done.
Writing objects: 100% (29/29), 2.79 KiB | 0 bytes/s, done.
Total 29 (delta 17), reused 0 (delta 0)
remote: Resolving deltas: 100% (17/17)
remote: Processing changes: refs: 1, done
remote: ERROR: missing Change-Id in commit message footer
remote: Suggestion for commit message:
remote: Merge branch 'master' of ssh://s3.testing.com:29418/testing into m
asoud
remote:
remote: Change-Id: I12be02f75b42c4304591835dffe8d7e8aa01f761
remote:
remote: Hint: To automatically insert Change-Id, install the hook:
remote:   gitdir=$(git rev-parse --git-dir); scp -p -P 29418 me@s3.testing.com:hooks/commit-msg ${gitdir}/hooks/
remote:
remote:
To ssh://me@s3.testing.com:29418/telewebion
 ! [remote rejected] HEAD -> refs/for/master (missing Change-Id in commit messag
e footer)
error: failed to push some refs to 'ssh://me@s3.testing.com:29418/
testing'

我也试过这些东西:

 scp -p -P 29418 username@your_gerrit_address:hooks/commit-msg .git/hooks/

git rebase masoud -i

git commit --amend

但我仍然得到同样的错误。

3 个答案:

答案 0 :(得分:1)

您的Change-Id丢失了。检查您的日志消息,确保Change-Id是提交消息的最后一行。

如果你已经复制到commit-msg hook,正如你所提到的那样,git commit --amend Change-Id现在应该出现在你提交消息中。

答案 1 :(得分:1)

您尝试推送合并提交。这些不是由gerrit commit msg hook修改的。但是,错误消息已经建议使用有效的ChangeId。

remote: Suggestion for commit message:
remote: Merge branch 'master' of ssh://s3.testing.com:29418/testing into m
asoud
remote:
remote: Change-Id: I12be02f75b42c4304591835dffe8d7e8aa01f761

所以,简单的做一个

git commit --amend

并在提交消息中作为最后一行插入上面的Change-Id

答案 2 :(得分:0)

见行

remote: Merge branch 'master' of ssh://s3.testing.com:29418/testing into m

asoud

表示存在合并提交。在合并提交之前,执行show log并对change id进行软重置。