Submmit to Gerrit w/o code review

If you want to submit changes directly without code review, especially when

  1. Import existing repositories, SDK, or other original opensource packages that does not need code review
  2. "git review" command fails due to remote branch does not exist

You can use commands as below instead to bypass code review process.

  1. Add "gerrit" remote if it does not exist, skip this if you have "gerrit" remote.

git remote add gerrit ssh://<username>@<gerrit_server>:29418/<project_name>.git

  1. Push your changes to Gerrit directly without code review.

git push gerrit "branch_name(eg HEAD:ref/for/master)"

eg:

  1. 查看 project name # git config -l (这里就是 prpos-v3.2.0)

  2. git remote -v 查看 remote 的 gerrit 仓库名 没有添加

git remote add gerrit ssh://<username>@<gerrit_server>:29418/<project_name>.git

  1. 推送本地到gerrit

git push gerrit HEAD:refs/heads/master // HEAD 本地最新

eg:git push gerrit HEAD:refs/for/master // 推送最新一笔code 到gerrit review

  1. Step 3 可能会失败

获取Git仓库目录

  1. gitdir=$(git rev-parse --git-dir) // 这里其实就是 .git 目录

从Gerrit服务器下载commit-msg钩 子并安装

  1. scp -p -P 29418 adley_cheng@172.21.67.99:hooks/commit-msg ${gitdir}/hooks/

eg: scp -p -P 29418 adley_cheng@172.21.67.99:hooks/commit-msg .git/hooks/

  1. git commit --amend --no-edit

  2. git push gerrit HEAD:refs/for/master // 再推送

一般需要gerrit review 才上code ,不要轻易 git push

相关推荐
深念Y7 天前
05-code-review-report
代码复审
数据知道9 天前
白盒审计入门:Source Code Review 检查清单
网络·安全·网络安全·代码复审
电子科技圈10 天前
IAR与东软睿驰达成战略合作,强化软件开发效率与生态协作
设计模式·开源·软件工程·软件构建·代码规范·设计规范·代码复审
zuozewei17 天前
7DGroup 开源 dsh-7d-tray-win 系统托盘插件
windows·代码复审
吨吨ai1 个月前
ChatGPT Plus / Pro 如何用好 Codex?AGENTS.md、测试闭环与 AI Code Review 实战
人工智能·chatgpt·代码复审
NutShell Wang1 个月前
拆解 GitHub gh-stack:堆叠 PR 工作流的设计取舍与工程实现
前端·git·开源·github·代码复审·开发者工具·vibe coding
繁荣的红酒2 个月前
Code Review有什么好处?
代码复审
江畔柳前堤2 个月前
第13章:docker生产环境部署实战
运维·git·docker·容器·代码复审
星落zx3 个月前
在CI/CD流水线里接入多模型自动Code Review,踩坑与方案分享
人工智能·ci/cd·代码复审
zhiSiBuYu05173 个月前
建立 AI 辅助开发的 Code Review 流程实战指南
人工智能·代码复审