当前位置:网站首页>hot-fix、cherry-pick怎么提
hot-fix、cherry-pick怎么提
2022-06-30 22:35:00 【小白目】
目录
hot-fix
是什么:热修复。
通俗来讲就是,开发时,生产环境prod上面有些什么小问题需要修改,我们就会提个 hot-fix 进行解决。
怎么办:从 pro 拉个临时分支,然后本地切换到临时分支上,进行修改,完了后合到 pro 即可。
举个例子:
1. 在远程仓库的pro分支处,新建分支,可命名为 hot-fix630
2. 切换到临时分支 git checkout -b origin/hot-fix630
3. 进行修改,然后push到远端
cherry-pick
是什么:捡樱桃
通俗来讲就是,开发时,距离上次发版到 pro 已经在 dev 环境上新增了多个功能,提交了很多次(建议每次提交只设计一个功能);现在需要把其中某个功能推到生产环境 pro。
怎么办:选中其中的几次commit推到pro,假如某次提交涉及多个功能,要把多余功能的代码注释或者删除。
注意:如果是多人开发同一个页面,原则上不能动其他人的代码!若他人也涉及到某些功能的提交,需要本人亲自相应处理。
如果每次commit都很规范(只涉及单个功能)则可用一下 git 命令:
// 合并一次commit; -x 可省,保留的话则可保留原提交者commit信息。
git cherry-pick -x <commit id>
// 合并多次commit; 闭区间
git cherry-pick <start-commit-id>^..<end-commit-id>
若某次提交涉及多个功能,则只能手动把多余功能的代码注释或者删除。
冲突处理
以上的过程,很有可能出现冲突,因为团队协作中你当前要提交的代码,可能与当前 pro 上面的某处代码不一样(别人上次提交的),你此时的提交就会出现冲突,那解决流程如下:
// 查看哪些文件出现冲突
git status
// 找到冲突处,手动修改
vim xxx.jsx
// 将该文件添加到缓存区
git add xxx.jsx
// 提交 push
git commit -m 'fix: 修改冲突'
git push
假如你从 dev 合并代码到 pro 出现冲突,需要在本地切换到 pro 分支 pull 当前 dev 的代码,然后解决冲突后再 push 到远端pro环境
边栏推荐
- Introduction to machine learning compilation course learning notes lesson 2 tensor program abstraction
- Win11电脑名如何更改?Win11更改电脑名的方法
- 分享十万级TPS的IM即时通讯综合消息系统的架构
- How to develop the exchange system? Mature technology case of digital currency exchange system development
- How cloud computing can protect online education in the post epidemic Era
- Cas classique multithreadé
- Redis' cache penetration, cache breakdown and cache avalanche
- Apache server OpenSSL upgrade
- How to upload binary pictures in uniapp
- Anfulai embedded weekly report no. 270: June 13, 2022 to June 19, 2022
猜你喜欢

与AI结对编程式是什么体验 Copilot vs AlphaCode, Codex, GPT-3

基于kubernetes平台微服务的部署

What if the taskbar is blank after win11 update? Solution to blank and stuck taskbar after win11 update

MIT博士论文 | 优化理论与机器学习实践

Tencent has been conducting advanced automated functional testing for 3 years. It is a gift to you who are confused in manual testing

电脑版微信文件存储在哪个文件夹可以找到

Where can I find the computer device manager

RIDE:获取图片base64

10 airbags are equipped as standard, and Chery arizer 8 has no dead corner for safety protection

Anfulai embedded weekly report no. 270: June 13, 2022 to June 19, 2022
随机推荐
Two way data binding in wechat applet
严格次小生成树
win11更新后任务栏空白怎么办? win11更新后任务栏空白卡死的解决方法
手机上怎么开股票账户?另外,手机开户安全么?
Smart streetlights | cloud computing lights up the "spark" of smart cities
Doker的容器数据卷
B_ QuRT_ User_ Guide(31)
Discuz forum speed up to delete XXX under data/log PHP file
机器学习编译入门课程学习笔记第二讲 张量程序抽象
A new one from Ali 25K came to the Department, which showed me what the ceiling is
CNN classic network model details -lenet-5 (pytorch Implementation)
leetcode:104. 二叉树的最大深度
电脑版微信文件存储在哪个文件夹可以找到
Is the stock account opened in qiniu safe? How to apply for a low commission stock account?
2022中国国潮发展新动向
Some memory problems summarized
2022-06-30: what does the following golang code output? A:0; B:2; C: Running error. package main import “fmt“ func main() { ints := make
Neo4j load CSV configuration and use
latex字母头顶两个点
Femas: cloud native multi runtime microservice framework