1k-git-workflow
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseOneKey Git Usage Guidelines
OneKey Git使用指南
Branch Management
分支管理
- Main branch: - This is the primary development branch
x - Workflow: → create feature branch → develop → PR back to
xx - Do not use ,
onekey, ormasteras the base branch - always usemainx - NEVER work directly on the branch → ALWAYS create feature branches
x
- 主分支:- 这是主要开发分支
x - 工作流:→ 创建功能分支 → 开发 → 提交PR合并回
xx - 不要使用、
onekey或master作为基础分支——始终使用mainx - 绝对不要直接在分支上工作→必须创建功能分支
x
Branch Naming
分支命名
- Feature branches: or
feat/descriptionfeature/description - Bug fixes:
fix/description - Refactoring:
refactor/description
- 功能分支:或
feat/描述feature/描述 - Bug修复分支:
fix/描述 - 重构分支:
refactor/描述
Commit Message Format
提交消息格式
Use Conventional Commits format:
- - New features
feat: - - Bug fixes
fix: - - Code refactoring
refactor: - /
perf:- Performance improvementsoptimize: - - Build, version, or non-code changes
chore: - - Documentation only
docs:
Format:
type: short description- Use lowercase
- Keep first line under 72 characters
- Include issue number if applicable:
fix: resolve login bug OK-12345
IMPORTANT - Claude Code commits:
- Do NOT include "Generated with Claude Code" link
- Do NOT include "Co-Authored-By: Claude" signature
- Commit message should be indistinguishable from human-written commits
使用Conventional Commits格式:
- - 新功能
feat: - - Bug修复
fix: - - 代码重构
refactor: - /
perf:- 性能优化optimize: - - 构建、版本或非代码变更
chore: - - 仅文档变更
docs:
格式:
type: 简短描述- 使用小写
- 首行不超过72个字符
- 如有需要,包含问题编号:
fix: 修复登录bug OK-12345
重要提示 - Claude Code提交:
- 不要包含“Generated with Claude Code”链接
- 不要包含“Co-Authored-By: Claude”签名
- 提交消息应与人工编写的消息无差异
PR Naming Convention
PR命名规范
Follow the same format as commit messages:
feat: add dark mode supportfix: resolve authentication timeout issuerefactor: simplify payment processing logic
遵循与提交消息相同的格式:
feat: 支持深色模式fix: 修复认证超时问题refactor: 简化支付处理逻辑
Common Git Commands
常用Git命令
Creating a Feature Branch
创建功能分支
bash
git checkout x
git pull origin x
git checkout -b feat/my-new-featurebash
git checkout x
git pull origin x
git checkout -b feat/my-new-featureCommitting Changes
提交变更
Option 1: Use /commit command (Recommended)
bash
/commitThe command automatically runs pre-commit checks ( and ) and creates a well-formatted commit message.
/commityarn lint:stagedyarn tsc:stagedOption 2: Manual commit with pre-checks
bash
undefined选项1:使用/commit命令(推荐)
bash
/commit/commityarn lint:stagedyarn tsc:staged选项2:手动提交并执行前置检查
bash
undefinedStage your changes
暂存变更
git add .
git add .
Run pre-commit checks (MANDATORY)
运行提交前检查(必须执行)
yarn lint:staged
yarn tsc:staged
yarn lint:staged
yarn tsc:staged
If checks pass, commit
检查通过后提交
git commit -m "feat: add user profile page"
**IMPORTANT**:
- NEVER commit code that fails linting or TypeScript compilation
- Pre-commit checks are mandatory as specified in CLAUDE.md
- The `/commit` command handles this automaticallygit commit -m "feat: 添加用户资料页面"
**重要提示**:
- 绝对不要提交未通过lint检查或TypeScript编译的代码
- 提交前检查是必须的,具体要求见CLAUDE.md
- `/commit`命令会自动处理这些步骤Pushing and Creating PR
推送并创建PR
bash
git push -u origin feat/my-new-featurebash
git push -u origin feat/my-new-featureThen create PR via GitHub UI or gh CLI
随后通过GitHub UI或gh CLI创建PR
undefinedundefinedRebasing on Latest x
基于最新x分支变基
bash
git fetch origin
git rebase origin/xbash
git fetch origin
git rebase origin/x