config-git
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseInteractive Git Configuration
交互式Git配置
Set up Git user identity and create with conventional commit scopes, types, and branch naming conventions.
.claude/git.local.mdCurrent Git Config Context:
!
git config --list --show-origin设置Git用户身份并创建文件,包含约定式提交的范围、类型以及分支命名规范。
.claude/git.local.md当前Git配置上下文:
!
git config --list --show-originPhase 1: Verify User Identity
阶段1:验证用户身份
Goal: Ensure git user.name and user.email are configured
Actions:
- Review the "Current Git Config Context" above
- Check if and
user.nameare setuser.email - If EITHER is missing, use to request the missing information
AskUserQuestion - Set the values globally (or locally if user specifies) using
git config
目标:确保已配置git user.name和user.email
操作:
- 查看上方的「当前Git配置上下文」
- 检查是否已设置和
user.nameuser.email - 若其中任意一项缺失,使用请求用户提供缺失的信息
AskUserQuestion - 使用全局设置(或按用户指定的本地设置)对应的值
git config
Phase 2: Analyze Project Context
阶段2:分析项目上下文
Goal: Understand project structure and existing commit patterns
Actions:
- Run or
ls -Fto detect project languages/frameworksfind . -maxdepth 2 -not -path '*/.*' - Run (if git repo exists) to analyze existing commit message patterns and scopes
git log --format="%s" -n 50
目标:了解项目结构和现有提交模式
操作:
- 运行或
ls -F检测项目使用的语言/框架find . -maxdepth 2 -not -path '*/.*' - (若Git仓库已存在)运行分析现有提交消息的模式和范围
git log --format="%s" -n 50
Phase 3: Determine Scopes
阶段3:确定提交范围
Goal: Generate appropriate commit scopes based on project structure
CRITICAL - Scope Naming Rules:
- ALL scopes MUST be short (single words or abbreviations only)
- Single words: use as-is (e.g., ,
<word1>,<word2>)<word3> - Multi-word names: MUST convert to first letters (e.g., →
<multi-word-name>,<mwn>→<another-example>)<ae> - MUST NOT use full multi-word names like or
<multi-word-name>as scopes<another-example>
Actions:
- Propose a list of commit scopes based on analysis
- Ensure all scopes follow the naming rules above
- Request user input ONLY if genuine ambiguity exists
目标:根据项目结构生成合适的提交范围
重要 - 范围命名规则:
- 所有范围必须简短(仅允许单个单词或缩写)
- 单个单词:直接使用(例如:、
<word1>、<word2>)<word3> - 多单词名称:必须转换为首字母缩写(例如:→
<multi-word-name>、<mwn>→<another-example>)<ae> - 禁止使用或
<multi-word-name>这类完整的多单词名称作为范围<another-example>
操作:
- 根据分析结果提交一份提交范围列表
- 确保所有范围都符合上述命名规则
- 仅在存在真正的歧义时才请求用户输入
Phase 4: Generate Configuration File
阶段4:生成配置文件
Goal: Create with complete structure from example template
.claude/git.local.mdCRITICAL - Template Requirements:
- Use the ENTIRE example file structure as template
- Preserve ALL sections from the example:
- YAML frontmatter with ,
scopes,types, ANDbranch_prefixesgitignore - "# Project-Specific Git Settings" section
- "## Usage" section with all bullet points
- "## Additional Guidelines" section with all bullet points
- YAML frontmatter with
Actions:
- Read the example configuration file:
${CLAUDE_PLUGIN_ROOT}/examples/git.local.md - Replace the list with determined short scopes
scopes - Update technologies based on detected project languages/frameworks
gitignore - Keep as standard conventional commit types (unless user requests changes)
types - Keep as shown in example (unless user requests changes)
branch_prefixes - Create or overwrite in the project root
.claude/git.local.md - Read the file back to verify it matches the example's complete structure
Output: file with project-specific configuration
.claude/git.local.md目标:参考示例模板创建结构完整的文件
.claude/git.local.md重要 - 模板要求:
- 必须使用示例文件的完整结构作为模板
- 保留示例中的所有章节:
- 包含、
scopes、types和branch_prefixes的YAML前置元数据gitignore - 「# 项目专属Git设置」章节
- 「## 使用方法」章节及所有要点
- 「## 额外指南」章节及所有要点
- 包含
操作:
- 读取示例配置文件:
${CLAUDE_PLUGIN_ROOT}/examples/git.local.md - 将列表替换为已确定的简短范围
scopes - 根据检测到的项目语言/框架更新对应的技术项
gitignore - 保留标准的约定式提交类型作为(除非用户要求修改)
types - 保留示例中显示的(除非用户要求修改)
branch_prefixes - 在项目根目录创建或覆盖文件
.claude/git.local.md - 重新读取文件以验证其结构与示例完全匹配
输出:包含项目专属配置的文件
.claude/git.local.mdPhase 5: Confirmation
阶段5:确认配置完成
Goal: Inform user of successful configuration
Actions:
- Confirm configuration is complete
- Show the location of the created file
目标:通知用户配置已成功完成
操作:
- 确认配置已完成
- 告知用户已创建文件的位置