commit

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese
Create a git commit for the current changes using a concise Conventional Commits-style subject.
使用简洁的Conventional Commits风格的主题,为当前变更创建Git提交。

Format

格式

<type>(<scope>): <summary>
  • type
    REQUIRED. Use
    feat
    for new features,
    fix
    for bug fixes. Other common types:
    docs
    ,
    refactor
    ,
    chore
    ,
    test
    ,
    perf
    .
  • scope
    OPTIONAL. Short noun in parentheses for the affected area (e.g.,
    api
    ,
    parser
    ,
    ui
    ).
  • summary
    REQUIRED. Short, imperative, <= 72 chars, no trailing period.
<type>(<scope>): <summary>
  • type
    必填。新增功能用
    feat
    ,修复bug用
    fix
    。其他常见类型:
    docs
    (文档)、
    refactor
    (重构)、
    chore
    (杂项)、
    test
    (测试)、
    perf
    (性能优化)。
  • scope
    可选。用括号包裹的简短名词,表示受影响的区域(例如
    api
    parser
    ui
    )。
  • summary
    必填。简短、祈使语气、不超过72个字符,结尾无句号。

Notes

注意事项

  • Body is OPTIONAL. If needed, add a blank line after the subject and write short paragraphs.
  • Do NOT include breaking-change markers or footers.
  • Do NOT add sign-offs (no
    Signed-off-by
    ).
  • Only commit; do NOT push.
  • If it is unclear whether a file should be included, ask the user which files to commit.
  • Treat any caller-provided arguments as additional commit guidance. Common patterns:
    • Freeform instructions should influence scope, summary, and body.
    • File paths or globs should limit which files to commit. If files are specified, only stage/commit those unless the user explicitly asks otherwise.
    • If arguments combine files and instructions, honor both.
  • 正文(Body)可选。如果需要,在主题后添加空行,然后撰写简短段落。
  • 请勿包含破坏性变更标记或页脚。
  • 请勿添加签名(不要
    Signed-off-by
    )。
  • 仅执行提交操作;请勿推送(push)。
  • 如果不确定是否应包含某个文件,请询问用户要提交哪些文件。
  • 将调用者提供的任何参数视为额外的提交指导。常见模式:
    • 自由格式的说明应影响范围、主题和正文。
    • 文件路径或通配符应限制要提交的文件。如果指定了文件,除非用户明确要求,否则仅暂存/提交这些文件。
    • 如果参数同时包含文件和说明,请同时遵循两者。

Steps

步骤

  1. Infer from the prompt if the user provided specific file paths/globs and/or additional instructions.
  2. Review
    git status
    and
    git diff
    to understand the current changes (limit to argument-specified files if provided).
  3. (Optional) Run
    git log -n 50 --pretty=format:%s
    to see commonly used scopes.
  4. If there are ambiguous extra files, ask the user for clarification before committing.
  5. Stage only the intended files (all changes if no files specified).
  6. Run
    git commit -m "<subject>"
    (and
    -m "<body>"
    if needed).
  1. 从提示信息中推断用户是否提供了特定的文件路径/通配符和/或额外说明。
  2. 查看
    git status
    git diff
    以了解当前变更(如果提供了参数指定的文件,则仅限这些文件)。
  3. (可选)运行
    git log -n 50 --pretty=format:%s
    查看常用的范围(scope)。
  4. 如果存在模糊的额外文件,请在提交前询问用户以明确。
  5. 仅暂存目标文件(如果未指定文件,则暂存所有变更)。
  6. 运行
    git commit -m "<subject>"
    (如果需要,添加
    -m "<body>"
    )。