git-committer

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Generating a git commit message

生成git提交信息

Instructions

使用说明

  1. Run
    git status --short
    ,
    git diff
    , and
    git diff --staged
    to gather current changes, including untracked files
  2. If there are staged files, generate commit message suggestions using only staged changes (including staged newly added files)
  3. If there are no staged files, include unstaged diff changes and untracked files in the suggestion context
  4. For untracked files, inspect file names and content (for example with
    git status --short
    and
    cat
    /
    sed
    ) so they are represented in the suggested message
  5. For more context, get the last 5 to 10 commit messages as well
  6. Suggest a commit message:
    • The commit message should be a single line
    • The commit message should be a summary of the changes
    • The commit message should follow conventional commit conventions
    • If there too many changes, suggest multiple commit messages with a split of files between each commit message
  1. 运行
    git status --short
    git diff
    git diff --staged
    来收集当前变更,包括未跟踪文件
  2. 如果存在暂存文件,仅使用暂存变更(包括暂存的新增文件)生成提交信息建议
  3. 如果没有暂存文件,则将未暂存的diff变更和未跟踪文件纳入建议上下文
  4. 对于未跟踪文件,检查文件名和内容(例如通过
    git status --short
    cat
    /
    sed
    命令),确保这些文件在建议的提交信息中有所体现
  5. 为获取更多上下文,也可以拉取最近5到10条提交信息
  6. 生成提交信息建议:
    • 提交信息需为单行
    • 提交信息需是变更内容的总结
    • 提交信息需符合约定式提交规范
    • 如果变更内容过多,可以建议多条提交信息,将不同文件拆分到对应提交信息中

Best practices

最佳实践

  1. Use present tense
  2. After the tag (e.g.
    feat:
    ), the first letter should be capitalized, unless it's a symbol like a function name
  1. 使用现在时态
  2. 在标签(例如
    feat:
    )之后,首字母应大写,除非是函数名这类符号