当前位置:网站首页>与开源项目同步开发& CodeReview & Pull Request & fork怎么拉取原始仓库
与开源项目同步开发& CodeReview & Pull Request & fork怎么拉取原始仓库
2022-07-29 05:19:00 【廖圣平】
场景1
在比较大型的团队开发中,为了保证代码质量与技术经理能够了解整个代码的逻辑,代码的上线需要有CodeReview 环节。
场景2
如果使用开源项目作为基础开发,fork 一段时间后源代码有更新或者修改了漏洞,没有同步对于团队来说是一种损失。
场景3
在场景2
的基础上如果在开发中发现开源项目的bug,或增加了新的功能,也可以通过Pull Request 为开源项目做自己的一份贡献。
方法
fork 主代码库(开源库),并把自己fork 的仓库clone到本地
1.查看当前关联的远程仓库,这个仓库是刚刚fork的
E:\linuxdir\php\xxx>git remote -v
origin [email protected].com:liaosp/xxx.git (fetch)
origin [email protected].com:liaosp/xxx.git (push)
2.关联主仓库(开源库)添加一个上游仓库(upstream )。
git remote add upstream [email protected].com:xxx/xxx.git
这时查看远程库:
E:\linuxdir\php\dingdongShop>git remote -v
origin [email protected].com:liaosp/xxx.git (fetch)
origin [email protected].com:liaosp/xxx.git (push)
upstream [email protected].com:xxx/xxx.git (fetch)
upstream [email protected].com:xxx/xxx.git (push)
同步主仓库
git pull upstream master
合并不了
git pull upstream master --allow-unrelated-histories
E:\linuxdir\php\dingdongShop>git pull upstream master
remote: Enumerating objects: 30, done.
remote: Counting objects: 100% (30/30), done.
remote: Compressing objects: 100% (21/21), done.
remote: Total 21 (delta 16), reused 0 (delta 0), pack-reused 0
Unpacking objects: 100% (21/21), 4.79 KiB | 75.00 KiB/s, done.
From gitee.com:ZhongBangKeJi/CRMEB
* branch master -> FETCH_HEAD
ec68235a..a52078d2 master -> upstream/master
Updating ec68235a..a52078d2
Fast-forward
crmeb/app/services/coupon/StoreCouponUserServices.php | 2 +-
crmeb/app/services/product/product/StoreProductServices.php | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
定期的执行合并,保证和主仓库其他同事提交的代码,也可以和开源项目保持同步开发。
codeReview
在git 控制面板(github/gitlab) 有一个PullRequest 的选项可以把自己提交的 commit 合并到主仓库
边栏推荐
- 表格与表单相关知识点总结
- Hcia-r & s self use notes (25) NAT technical background, NAT type and configuration
- Qframe class learning notes
- Niuke network programming problem - [wy22 Fibonacci series] and [replace spaces] detailed explanation
- QT layout management -- Part stretch principle and sizepolicy
- Day 2
- 【无标题】
- Related knowledge of elastic box
- Do students in the science class really understand the future career planning?
- B - identify floating point constant problems
猜你喜欢
随机推荐
Qframe class learning notes
uniapp之常用提示弹框
Common characteristic engineering operations
Introduction to C language array to proficiency (array elaboration)
Basic concepts of MySQL + database system structure + extended application + basic command learning
Abstract classes and interfaces
WIN10 编译ffmpeg(包含ffplay)
字符类型转换
Character type conversion
DAY14:Upload-labs 通关教程
Summary of the first week
【电子电路】ADC芯片如何选型
shell基本操作(上)
Detailed installation and use tutorial of MySQL (nanny installation with pictures and texts)
Clickhouse learning (VII) table query optimization
DAY6:利用 PHP 编写文件上传页面
Use QSS to style the form
Similarities and differences between REM and PX and EM
Relationship between redrawing and reflow
[typescript] in depth study of typescript functions