docs/community/HOW_TO_MIGRATE_YOUR_PR.zh-CN.md
本指南帮助你将现有 PR 迁移以满足新的 PR 管理系统要求。
虽然你的现有 PR 仍将按照当前标准审核和合并,但将其迁移到新格式可以获得:
✅ 更快的审核 - 自动化检查尽早捕获问题 ✅ 更好的反馈 - CI 提供清晰、可操作的反馈 ✅ 更高质量 - 一致的代码标准 ✅ 学习机会 - 了解我们新的贡献工作流程
# 运行 PR 健康检查(只读,不修改任何内容)
./scripts/pr-check.sh
这将分析你的 PR 并告诉你:
根据建议,手动修复问题。常见修复:
# Rebase 到最新 dev
git fetch upstream && git rebase upstream/dev
# 格式化 Go 代码
go fmt ./...
# 运行测试
go test ./...
# 格式化前端代码
cd web && npm run lint -- --fix
# 验证所有问题都已修复
./scripts/pr-check.sh
git push -f origin <your-pr-branch>
upstream/dev 同步go fmt)go vet)如果你更喜欢手动操作:
# 如果还没添加 upstream,添加它
git remote add upstream https://github.com/NoFxAiOS/nofx.git
# 获取最新更改
git fetch upstream
# Rebase 你的分支
git checkout <your-pr-branch>
git rebase upstream/dev
# 格式化 Go 代码
go fmt ./...
# 运行 linting
go vet ./...
# 运行测试
go test ./...
# 如果有更改,提交它们
git add .
git commit -m "chore: format and fix backend issues"
cd web
# 安装依赖
npm install
# 修复 linting 问题
npm run lint -- --fix
# 检查类型
npm run type-check
# 测试构建
npm run build
cd ..
# 提交任何修复
git add .
git commit -m "chore: fix frontend issues"
确保你的 PR 标题遵循 Conventional Commits:
<type>(<scope>): <description>
示例:
feat(exchange): add OKX integration
fix(trader): resolve position tracking bug
docs(readme): update installation guide
类型:
feat - 新功能fix - Bug 修复docs - 文档refactor - 代码重构perf - 性能改进test - 测试更新chore - 构建/配置更改security - 安全改进git push -f origin <your-pr-branch>
迁移后,验证:
dev rebase推送更改后:
如果在 rebase 期间遇到冲突:
# 在编辑器中修复冲突
# 然后:
git add <fixed-files>
git rebase --continue
# 或中止并寻求帮助:
git rebase --abort
需要帮助? 在你的 PR 中评论,我们会协助!
如果测试失败:
# 运行测试查看错误
go test ./...
# 修复问题
# 然后提交并推送
git add .
git commit -m "fix: resolve test failures"
git push -f origin <your-pr-branch>
如果迁移脚本不工作:
不想迁移?
第一次使用 Git rebase?
想了解更多?
迁移遇到困难?
我们在这里帮助你成功! 🚀
迁移完成后:
感谢你为 NOFX 做出贡献!