Gerrit --- not clone with commit
2020-07-09 本文已影响0人
嘻哈章鱼小丸子
由于项目比较紧张,clone代码的时候没有选择clone with commit-msg hook选项,直接使用了默认的clone选项。

导致提交代码的时候报错了:没有自动生成 Change-Id。

注意:上图中黄色的Hint下面,已经给出了生成Change-Id的命令,需要安装commit-msg这个hook,复制即可。
gitdir=$(git rev-parse --git-dir); scp -p -P 29419 域名:hooks/commit-msg ${gitdir}/hooks/
执行完后会给出下面的提示,提示安装成功:

然后在去项目下看看是否增加了commit-msg这个文件:

安装成功了必须有,哈哈哈,日期也是对的。
再按照之前的Hint 提示amend the commit:
git commit --amend
可以看到修改的文件重新commit了,然后push
git push origin HEAD:refs/for/dev
成功啦~
可以看到My tab 下的changes 目录已经有自己提交的代码了,审核下就可以,so easy。