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
- 創建開發分支
如創建新功能分支參考如下創建:
如創建修復 bug 分支參考如下創建:git checkout -b feat/<feature-name>
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## DescriptionPlease include a summary of the changes and the related issue.
Also, include relevant motivation and context.Fixes #(issue number)## Type of ChangePlease 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 NotesAdd any other context or screenshots about the PR here.