解决git提交到gerrit ERROR: missing Change-Id in commit message footer 问题

出现该问题的原因是 执行 git commit 没有生成 Change-Id 或者是从本地分支合并过来的,但是 提交 gerrit必须要有 Change-Id ,否则会被拒绝.其实错误信息已经提示如何解决该问题:

Resolving deltas: 100% (10/10)
remote: Processing changes: refs: 1, done    
remote: ERROR: missing Change-Id in commit message footer
remote: 
remote: Hint: To automatically insert Change-Id, install the hook:
remote:   gitdir=$(git rev-parse --git-dir); scp -p -P 29418 rgchen@10.0.0.234:hooks/commit-msg ${gitdir}/hooks/
remote: And then amend the commit:
remote:   git commit --amend
remote: 
  • 解决办法:

    1. install the hook 让每次提交自动插入 Change-Id 安装方法提示的有: gitdir= (gitrevparsegitdir);scppP29418rgchen@10.0.0.234:hooks/commitmsg {gitdir}/hooks/
    2. 重新更新提交信息 git commit –amend “这里写更新注释”
    3. 然后重新 upload 或者 push

      附上git merge 方式:

      git merge branch_name fast-farward merge

    git merge –no-ff branch_name 会执行正常合并

参考文章:

代码合并:Merge、Rebase的选择

git merge简介

你可能感兴趣的:(必备工具)