当前位置:网站首页>与开源项目同步开发& 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 合并到主仓库
边栏推荐
猜你喜欢

uniapp组件之tab选项卡滑动切换

Win10 搭建MSYS2环境

Fvuln-自动化web漏洞检测工具

QT setting background image method
![[typescript] type reduction (including type protection) and type predicate in typescript](/img/74/52fe769ed3850e01d97cb9fefb7373.png)
[typescript] type reduction (including type protection) and type predicate in typescript

Clickhouse learning (x) monitoring operation indicators

OpenAtom OpenHarmony分论坛圆满举办,生态与产业发展迈向新征程

Basic concepts of MySQL + database system structure + extended application + basic command learning

【TypeScript】深入学习TypeScript函数

ClickHouse学习(六)语法优化
随机推荐
[sword finger offer] - explain the library function ATOI and simulate the realization of ATOI function
shell基本操作(下)
Day14: upload labs customs clearance tutorial
HCIA-R&S自用笔记(24)ACL
DAY5:PHP 简单语法与使用
[electronic circuit] how to select ADC chip
About local variables
DAY15:文件包含漏洞靶场手册(自用 file-include 靶场)
AR虚拟增强与现实
Sqlmap是什么以及使用方法
[typescript] type reduction (including type protection) and type predicate in typescript
ClickHouse学习(三)表引擎
第三课threejs全景预览房间案例
Hcia-r & s self use notes (26) PPP
uniapp之常用提示弹框
Niuke network programming problem - [wy22 Fibonacci series] and [replace spaces] detailed explanation
On Paradigm
Related knowledge of elastic box
虚拟增强与现实第二篇 (我是一只火鸟)
[JS question solution] questions 1-10 in JS of niuke.com