2014-07-08 199 views
0

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

$ 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 [email protected]:hooks/commit-msg ${gitdir}/hooks/ 
remote: 
remote: 
To ssh://[email protected]:29418/telewebion 
! [remote rejected] HEAD -> refs/for/master (missing Change-Id in commit messag 
e footer) 
error: failed to push some refs to 'ssh://[email protected]:29418/ 
testing' 

我想这些东西太:

scp -p -P 29418 [email protected]_gerrit_address:hooks/commit-msg .git/hooks/ 

git rebase masoud -i 

git commit --amend 

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

+0

你的git存储库比默认的有更严格的规则。你必须遵守他们才能推动。仔细阅读以“remote:”开头的所有行。 –

回答

1

您的Change-Id已遗失。检查您的日志消息并确保Change-Id是您提交消息的最后一行。

如果您已复制到commit-msg挂钩,如您所述,并已完成git commit --amend,则Change-Id现在应存在于您的提交消息中。

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值的信息作为最后一行的上方。

0

见行

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

asoud

这表明,有一个合并提交。在此合并提交之前,执行显示日志并对更改ID执行软重置。