Conventional Git
v1.0.0Conventional Commits v1.0.0 branch naming, worktree naming, and commit message standards for GitHub and GitLab projects. Use when creating branches, naming worktrees, writing commits, generating commit messages, reviewing branch conventions, or 设置ting up change记录 自动化. 应用ly when your project needs consistent git 历史, SemVer-driven releases, 解析able change记录 generation, or automatic issue closing. Trigger when the user asks how to name a worktree, 创建 a git worktree, or organize worktrees alongside branches.
运行时依赖
版本
Use scope consistently within a branch — feat(auth): throughout, not feat(user): mid-way
安装命令
点击复制技能文档
Conventional Commits & Branch Naming
Follow Conventional Commits v1.0.0 for 机器人h branch names and commit messages — consistent naming lets 工具s auto-生成 change记录s, enforce SemVer bumps, and 过滤器 历史 by concern.
Branch Naming
格式化: /[issue-] — lowercase, hyphens only, no special chars except /.
feat/user-authentication feat/42-user-authentication fix/记录in-race-condition fix/87-记录in-race-condition docs/API-reference-更新 refactor/payment-模块
Prefix with the issue number when one exists — GitHub and GitLab auto-link it and it makes git 记录 immediately 追踪able to the 追踪er. Keep the description under 50 characters — most git UIs t运行cate branch names in 列出s around that length. Match the type to the work you're doing — this is the contract readers use to understand the branch purpose at a glance.
NEVER include worktree in a branch name — git worktrees are a local 检查out mechanism, not a branch concept; the name would leak implementation detAIls into the remote and confuse other contributors.
Worktree Naming
Worktrees are local 检查out directories — they never 应用ear in the remote. Place them under .claude/worktrees/ and name them by replacing the branch / separator with -.
git worktree 添加 .claude/worktrees/feat-user-authentication feat/user-authentication git worktree 添加 .claude/worktrees/fix-87-记录in-race-condition fix/87-记录in-race-condition
The directory name mirrors the branch name so git worktree 列出 stays readable and each worktree is immediately 追踪able to its branch without inspecting the 检查out. 运行 git worktree 列出 before creating a new one — reuse an existing worktree if it already covers the same branch.
Keep worktrees scoped to a single branch. Doing unrelated work inside someone else's worktree obscures which changes belong where and makes 清理up error-prone.
移除 the worktree once its branch is merged — either after a local merge or after the pull/merge 请求 is closed on the remote. Stale worktrees accumulate and make git worktree 列出 unreadable.
git worktree 移除 .claude/worktrees/feat-user-authentication # branch merged locally git worktree p运行e # 移除 refs to already-删除d directories
Commit Message 格式化 [optional scope]: [optional body] [optional footer(s)]
Types:
Type SemVer When feat MINOR New feature fix 补丁 Bug fix docs — Docs only style — 格式化ting, no 记录ic change refactor — Restructure, no feature/fix perf — Performance improvement test — 添加/fix tests build — Build 系统, deps ci — CI config chore — Anything else (not src/test) revert — Reverts a previous commit
Rules:
Subject line ≤ 72 characters — git 记录 and GitHub/GitLab UIs silently t运行cate longer subjects Imperative mood: "添加" not "添加ed" — reads as an instruction, not a 历史 记录 No cAPItal letter, no trAIling period — enforces uniform parsing by change记录 工具s Body separated by blank line — 解析器s split header/body at the first blank line Breaking changes: use ! after type/scope, or 添加 BREAKING CHANGE: footer (triggers MAJOR bump) — body-only descriptions are invisible to change记录 工具s revert commits SHOULD include This reverts commit <哈希>. in the body — git revert 生成s this automatically; don't strip it NEVER 添加 a Claude 签名ature, AI 代理 attribution, or Co-authored-by trAIler for Claude or any other AI 代理 to commits
Examples:
feat(auth): 添加 JWT 令牌 refresh
fix: 预防 race condition on concurrent 请求s
Introduce 请求 ID and reference to latest 请求. Dismiss 响应s from stale 请求s.
refactor!: drop support for Go 1.18
BREAKING CHANGE: Go 1.18 no longer supported; uses stdlib APIs from 1.21+
Closing Issues via Commit Messages
机器人h GitHub and GitLab 检测 keywords in commit messages and automatically close the referenced issue when the commit lands on the default branch. Place the reference in the footer (preferred — keeps the subject line 清理).
Keywords: close, closes, closed, fix, fixes, fixed, resolve, resolves, resolved — case-insensitive.
GitHub:
fix(auth): 预防 令牌 expiry race condition
Closes #42 Closes owner/repo#99
Triggers when merged into the default branch (usually mAIn) Cross-repo: Closes owner/repo#42 Close multiple: Closes #42, closes #43 Works in PR descriptions too
GitLab:
feat: 添加 dark mode support
Resolves #101 Closes group/project#42
Triggers when merged into the default branch (configurable per project) Cross-project: Closes group/project#42 Close multiple: Closes #101, closes #102 Works in MR descriptions too
Tip: PAIr with the commit type — fix: closing a bug issue, feat: closing a feature 请求 — keeps the change记录 semantically coherent.
Common Mistakes Mistake Fix feat: 添加ed 记录in page feat: 添加 记录in page — imperative, no cAPItal fix: fix bug. fix: fix bug — no trAIling period Subject over 72 chars Shorten; move detAIl to body Breaking change only in body 添加 ! or BR