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

相关推荐
十步杀一人_千里不留行12 天前
Code Review 的自我感动
代码复审
逍遥德15 天前
如何学编程之理论篇.03.如何做数据库表结构设计?
开发语言·数据库·性能优化·代码规范·代码复审
逍遥德17 天前
编程技能点小记之if-else条件分支合理用法
java·开发语言·代码规范·代码复审·极限编程·代码覆盖率
Kingairy17 天前
Claude Python3+pytest Code Review skill.md
pytest·代码复审
逍遥德19 天前
如何学编程之02.理论篇.如何写出具有良好健壮性的代码?
java·开发语言·性能优化·代码规范·代码复审
SZleoWang1 个月前
如何进行高质量的 Code Review?
代码复审
帅次2 个月前
新年快乐:软件架构设计的软件架构概述、软件架构建模、软件架构风格
软件工程·软件构建·需求分析·代码规范·设计规范·规格说明书·代码复审
帅次2 个月前
系统分析师:软件需求工程的需求定义、需求验证和需求管理
软件工程·软件构建·需求分析·代码规范·设计规范·规格说明书·代码复审
具***72 个月前
“气动弹性系统的能量图方法Matlab程序”及其相关内容介绍
代码复审