gerrit代码review使用基本方法

1、repo拉取代码

repo init -u ssh://gerrit.senseauto.com/senseauto_manifest -b develop -m senseauto-config.xml --repo-url=ssh://gerrit.senseauto.com:29418/senseauto_repo --repo-branch=develop --no-repo-verify

repo sync -j4

repo forall -j 4 -p -c 'git lfs pull'

2、修改代码

git pull可以拉取所有分支的代码

git checkout branch-dev(切换到开发分支,如果和origin名称一样会自动关联远程分支,可以用git branch -vv或者git log确认)

git add xx

git commit -m "xx"

git push origin HEAD:refs/for/develop%topic=test-topic

3、过CI

jenkins上通过特定的CI pipeline,

通过build with param绑定分支 以及topic

4、merge dev

添加代码reviewer确认

或者通过reply 添加确认,无误后进行merge submit。

5、合入release-xxx分支

通过cherry-pick方式

git checkout release-xxx分支

在gerrit上merge成功的页面找到download path,选择cherry-pick

git fetch "ssh://yangyuxin@gerrit.senseauto.com:29418/senseauto_modules_perception_camera" refs/changes/19/178319/3 && git cherry-pick FETCH_HEAD

如果没有冲突,则成功合入,git push即可

git push origin HEAD:refs/for/release-xxx%topic=test-topic

如果有冲突,则进行修改后,git cherry-pick continue

参考:https://www.ruanyifeng.com/blog/2020/04/git-cherry-pick.html

紧急处理

  • 如果合入错误分支,可以使用版本回退

    git reset --hard HEAD~3 # 回退上上上一个版本

    git reset --hard bae128 # 回退到某个版本回退点之前的所有信息。

  • 很多修改的文件丢弃

    git chekout .

    .匹配了所有的文件,相当于git checkout all-files

相关推荐
南宫真汀1 小时前
微信小程序项目上传到git仓库(完整操作)
git
夜月yeyue2 小时前
嵌入式开发中的 Git CI/CD
c++·git·单片机·嵌入式硬件·ci/cd·硬件架构
真人不梦3 小时前
Lazygit: 从0到熟练使用,你需要的都在这里
git·github
denggun123457 小时前
图片上传git时压缩
git·ios·objective-c·iphone·xcode
行走的陀螺仪9 小时前
git-旧项目继续开发新功能,同时还要维护线上版本
git·git push·git commit·git 协同开发
fendouweiqian14 小时前
git提交与commitlint规则
git
C.咖.21 小时前
Linux环境下——Git 与 GitHub
linux·git·github·远程仓库
杂鱼豆腐人1 天前
pnpm环境下防止误使用npm的方法
前端·git·npm·node.js·git bash
摇滚侠1 天前
GIT版本管理工具轻松入门 | TortoiseGit,Git 介绍软件安装配置,笔记01
笔记·git
山有木兮木有枝_1 天前
“误操作导致 feat 功能未生效,尽管 merge 已完成”
git