开源项目如何贡献代码

以腾讯犀牛鸟开源项目ncnn为例

目录

fork项目仓库

添加远程仓库

同步更新仓库

贡献代码提交新PR

PR未merge更新PR


fork项目仓库

只需要做一次

到仓库页面点击fork,然后create forkTencent/ncnn: ncnn is a high-performance neural network inference framework optimized for the mobile platform (github.com)icon-default.png?t=N7T8https://github.com/Tencent/ncnn

到自己fork的仓库复制下自己的仓库地址GitHub - YEZIPRO/ncnn: ncnn is a high-performance neural network inference framework optimized for the mobile platformncnn is a high-performance neural network inference framework optimized for the mobile platform - GitHub - YEZIPRO/ncnn: ncnn is a high-performance neural network inference framework optimized for the mobile platformicon-default.png?t=N7T8https://github.com/YEZIPRO/ncnn.git 到本地git工具命令本仓库

git clone https://github.com/YEZIPRO/ncnn.git

拉取若出现 Failed to connect to github.com port 443 after 21096 ms: Couldn't connect to server 问题,使用命令解决

git config --global --unset http.proxy

或者这个解决

git config --global --unset https.proxy

添加远程仓库

只需要做一次

进入项目仓库

cd ncnn

将原始仓库添加为本地仓库的远程仓库

git remote add upstream https://github.com/Tencent/ncnn.git

同步更新仓库

跟上原始仓库的变化

进入仓库

cd ncnn

将当前分支切换到master分支

git checkout master

从远程原始仓库获取最新的代码更新

git fetch upstream

若出现  Recv failure: Connection was reset 问题,使用下面两种方法解决

git config --global --unset http.proxy

或这个

git config --global --unset https.proxy

将远程原始仓库的master分支合并到当前分支

git merge upstream/master

推送到自己的GitHub仓库

git push

可能需要密码登录验证授权 

贡献代码提交新PR

先同步原始仓库,即上一个模块讲的东西

GitHub上自己的仓库新建分支,比如叫pnnx-torch-cross

常规进入项目

cd ncnn

 获取最新的更新

git pull

切换到新建分支

git checkout pnnx-torch-cross

coding……

提交代码到暂存区

git add .

创建一个提交

git commit -m "提交信息"

推送到自己的GitHub仓库

git push

在GitHub自己仓库切换到新建分支,点击create pull request提交新PR

PR未merge更新PR

进入项目仓库

cd ncnn

切换到该分支

git checkout pnnx-torch-cross

获取原始仓库最新代码

git fetch upstream

将原始仓库master分支合并至当前分支

git merge upstream/master

修改代码coding……

提交代码到暂存区

git add .

创建一个提交

git commit -m "提交信息"

推送到自己的GitHub仓库

git push
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

MaolinYe(叶茂林)

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值