Skip to main content

开源代码合并规范

合并介绍

开源项目可以接收来自全世界的代码合并请求,不要成为项目的maintainer或者developer。Github提供了最佳合并实践:

  1. fork开源仓库的项目到个人仓库,后续需要定期和原始项目同步
  2. 克隆个人仓库的项目代码基于issue进行开发测试
  3. 提交代码到个人仓库,在github上提交pr请求合并到main分支
  4. 等待开源项目的maintainer评审
  5. 评审通过后,个人仓库的代码会自动合并到开源仓库的项目中

详细流程

https://github.com/DefiLlama/chainlist.git为例说明

Fork项目

登陆github,fork你想参与的开源项目,

克隆项目

git clone https://github.com/liuppx/chainlist.git

# 添加原始仓库作为上游
git remote add upstream https://github.com/DefiLlama/chainlist.git

# 如果不是第一次,确保本地代码最新
git pull upstream main

创建开发分支

# 创建分支开发
git checkout -b fix/your-fix-name

# 代码修改以后
git push origin fix/your-fix-name

创建PR

登陆github,进入fork的项目,创建PR合并到原始项目https://github.com/DefiLlama/chainlist.git