1k-git-workflow

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

OneKey Git Usage Guidelines

OneKey Git使用指南

Branch Management

分支管理

  • Main branch:
    x
    - This is the primary development branch
  • Workflow:
    x
    → create feature branch → develop → PR back to
    x
  • Do not use
    onekey
    ,
    master
    , or
    main
    as the base branch - always use
    x
  • NEVER work directly on the
    x
    branch → ALWAYS create feature branches
  • 主分支
    x
    - 这是主要开发分支
  • 工作流
    x
    → 创建功能分支 → 开发 → 提交PR合并回
    x
  • 不要使用
    onekey
    master
    main
    作为基础分支——始终使用
    x
  • 绝对不要直接在
    x
    分支上工作→必须创建功能分支

Branch Naming

分支命名

  • Feature branches:
    feat/description
    or
    feature/description
  • Bug fixes:
    fix/description
  • Refactoring:
    refactor/description
  • 功能分支:
    feat/描述
    feature/描述
  • Bug修复分支:
    fix/描述
  • 重构分支:
    refactor/描述

Commit Message Format

提交消息格式

Use Conventional Commits format:
  • feat:
    - New features
  • fix:
    - Bug fixes
  • refactor:
    - Code refactoring
  • perf:
    /
    optimize:
    - Performance improvements
  • chore:
    - Build, version, or non-code changes
  • docs:
    - Documentation only
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:
    - 新功能
  • fix:
    - Bug修复
  • 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 support
  • fix: resolve authentication timeout issue
  • refactor: 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-feature
bash
git checkout x
git pull origin x
git checkout -b feat/my-new-feature

Committing Changes

提交变更

Option 1: Use /commit command (Recommended)
bash
/commit
The
/commit
command automatically runs pre-commit checks (
yarn lint:staged
and
yarn tsc:staged
) and creates a well-formatted commit message.
Option 2: Manual commit with pre-checks
bash
undefined
选项1:使用/commit命令(推荐)
bash
/commit
/commit
命令会自动运行提交前检查(
yarn lint:staged
yarn tsc:staged
)并生成格式规范的提交消息。
选项2:手动提交并执行前置检查
bash
undefined

Stage 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 automatically
git commit -m "feat: 添加用户资料页面"

**重要提示**:
- 绝对不要提交未通过lint检查或TypeScript编译的代码
- 提交前检查是必须的,具体要求见CLAUDE.md
- `/commit`命令会自动处理这些步骤

Pushing and Creating PR

推送并创建PR

bash
git push -u origin feat/my-new-feature
bash
git push -u origin feat/my-new-feature

Then create PR via GitHub UI or gh CLI

随后通过GitHub UI或gh CLI创建PR

undefined
undefined

Rebasing on Latest x

基于最新x分支变基

bash
git fetch origin
git rebase origin/x
bash
git fetch origin
git rebase origin/x