当前位置:网站首页>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环境
边栏推荐
- What is the experience of pairing with AI? Pilot vs alphacode, Codex, gpt-3
- Yolo target detection
- 唯一性索引与逻辑删除冲突问题解决思路
- latex左侧大括号 latex中大括号多行公式
- 严格次小生成树
- [Android, kotlin, tflite] mobile device integration deep learning light model tflite (object detection)
- Meet the StreamNative | 杨子棵:是什么让我放弃了大厂 Offer
- Ideal interface automation project
- 十个最为戳心测试/开程序员笑话,念茫茫人海,该如何寻觅?
- 企业出海数字化转型解决方案介绍
猜你喜欢
![Flip the linked list ii[three ways to flip the linked list +dummyhead/ head insertion / tail insertion]](/img/a8/6472e2051a295f5e42a88d64199517.png)
Flip the linked list ii[three ways to flip the linked list +dummyhead/ head insertion / tail insertion]

Why does the computer speed slow down after vscode is used for a long time?

latex字母头顶两个点

公有云市场迈入深水区,冷静的亚马逊云还坐得住吗?

理想中的接口自动化项目

JVM Part 21 of interview with big companies Q & A

企业出海数字化转型解决方案介绍

How to realize the center progress bar in wechat applet

十个最为戳心测试/开程序员笑话,念茫茫人海,该如何寻觅?

win11更新后任务栏空白怎么办? win11更新后任务栏空白卡死的解决方法
随机推荐
latex中 & 号什么含义?
During telecommuting, the project team punched in the wechat group | solicited papers from the community
多线程经典案例
[450. delete nodes in binary search tree]
Braces on the left of latex braces in latex multiline formula
深入解析 Apache BookKeeper 系列:第四篇—背压
[golang] golang implements the string interception function substr
公有云市场迈入深水区,冷静的亚马逊云还坐得住吗?
Ten of the most heart piercing tests / programmer jokes, read the vast crowd, how to find?
Yolo target detection
CNN经典网络模型详解-LeNet-5(pytorch实现)
Classic case of multithreading
How to upload binary pictures in uniapp
Redis的事务和锁机制
How to realize the center progress bar in wechat applet
Web APIs comprehensive case -tab column switching - dark horse programmer
“飞桨+辨影相机”成为AI界的“预制菜”,工业AI质检落地更简单
[无线通信基础-13]:图解移动通信技术与应用发展-1-概述
I want to know who I need to know to open a stock account? In addition, is it safe to open a mobile account?
Introduction to machine learning compilation course learning notes lesson 2 tensor program abstraction