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

相关推荐
weixin_4045512414 天前
使用implementation-verificator Skill来harness plan和code的一致性
ai·代码复审·code·skill·plan
奇树谦14 天前
AbsInt Launcher 详细介绍
代码复审
zhangfeng113318 天前
适合 5人以内小团队的Git 工作流 + Code Review + 自动化部署方案 FastAdmin +linunx服务器宝塔系统 外包项目 —
服务器·git·自动化·php·代码复审
SKY -dada21 天前
Understand 使用教程
开发语言·c#·流程图·软件构建·敏捷流程·代码复审·源代码管理
剑飞的编程思维1 个月前
架构评审核心维度自查表
架构·个人开发·代码复审
东方隐侠安全团队-千里1 个月前
DataGear 源码审计记录:我重点看了两条危险链
安全·代码规范·代码复审
极客小云1 个月前
【AiCodeAudit 2.0 发布:基于调用图与局部子图的 AI 代码安全审计平台】
人工智能·网络安全·语言模型·大模型·github·安全性测试·代码复审
彭波3962 个月前
Steam致命错误failed to load steamui.dll?磁盘写入错误怎么解决?steam安装游戏为什么磁盘写入错误?提供一些可问题解决方案
游戏·阿里云·电脑·开源软件·代码复审
剑飞的编程思维2 个月前
技术评审方法与流程全解析-如何做好技术评审
git·架构·个人开发·学习方法·技术美术·代码复审