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

相关推荐
星落zx19 分钟前
在CI/CD流水线里接入多模型自动Code Review,踩坑与方案分享
人工智能·ci/cd·代码复审
zhiSiBuYu05172 天前
建立 AI 辅助开发的 Code Review 流程实战指南
人工智能·代码复审
hai3152475432 天前
九章编程法 · 字典引擎【0/1拓扑步进 · 矩阵压缩·终极封版】
人工智能·数学建模·性能优化·动态规划·代码复审·傅立叶分析·极限编程
小马爱打代码4 天前
Coding及Code Review规范指引
代码复审
Rain50910 天前
实战:搭建 AI Code Review 自动化流水线
前端·人工智能·git·ci/cd·自动化·ai编程·代码复审
随风丶飘19 天前
AI Code Review 实测:GitHub Copilot PR Review 与 CodeRabbit,能否替代人工 Review?
人工智能·github·代码复审
❀͜͡傀儡师19 天前
Claude Code v2.1.147 发布:/code-review、Workflow,以及一个更大的算盘
代码复审·claude code
weixin_404551241 个月前
使用implementation-verificator Skill来harness plan和code的一致性
ai·代码复审·code·skill·plan
奇树谦1 个月前
AbsInt Launcher 详细介绍
代码复审