GitHub PR 提交流程

发布于:2025-08-18 ⋅ 阅读:(23) ⋅ 点赞:(0)

step1

  • 在 GitHub 上 fork 目标仓库(手动操作)

step2

  • 将 fork 的目标仓库克隆到本地
git clone https://github.com/<your-username>/<repo-name>.git
cd <repo-name>

step3

  • 与上游目标仓库建立链接
git remote add upstream https://github.com/<original-owner>/<repo-name>.git

  • 确认是否建立链接
git remote -v 

step4

  • 同步上游目标仓库代码
git pull upstream main

step5

  • 创建开发分支
    如创建新功能分支参考如下创建:
    git checkout -b feat/<feature-name>
    
    如创建修复 bug 分支参考如下创建:
    git checkout -b fix/<fix-name>
    
  • 完成功能开发
  • 提交代码
git commit -m "feat: xxx" // or git commit -m "fix: xxx"

step6

  • 推送分支
git push origin feat/<feature-name>

step7

  • 在 GitHub 目标仓库上创建 PR(手动操作)
    打开 GitHub 网页fork 的目标仓库上,选择从 feat/ -> upstream/main 发起 Pull Request

  • PR模板参考

# Pull Request Template

## Description

Please include a summary of the changes and the related issue.  
Also, include relevant motivation and context.

Fixes #(issue number)

## Type of Change

Please delete options that are not relevant.

- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [ ] Documentation update

## How Has This Been Tested?

Please describe the tests that you ran to verify your changes.  
Include details of your test environment, and instructions to reproduce.  

- [ ] Test A
- [ ] Test B

## Checklist:

- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my own code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
- [ ] My changes generate no new warnings
- [ ] Any dependent changes have been merged and published in downstream modules

## Additional Notes

Add any other context or screenshots about the PR here.


网站公告

今日签到

点亮在社区的每一天
去签到