如何识别绕过 gerrit 的提交

How to identify commits that bypassed gerrit

我对 git 的了解很少,如有任何错误的术语使用,请提前致歉。

我知道 git push origin HEAD:refs/for/master 创建一个 gerrit 审查并 git push origin HEAD:master 推送到远程存储库,绕过 gerrit。

如何识别绕过 gerrit 直接推送到远程 git 存储库的提交?

您可以使用 Gerrit Query 功能来获取有关代码审查的信息。例如:

  1. 获取所有提交的列表;
  2. 尝试通过运行ssh ${GERRIT_HOST} gerrit query --all-reviewers project:${PROJECTNAME} commit:${COMMIT_HASH};
  3. 查询列表中每个提交的信息
  4. 如果result为空,则commit已经直接push了,没有 代码审查;