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. 生成提交信息建议:
    • 提交信息应为单行格式
    • 提交信息应是变更内容的总结
    • 提交信息需遵循Conventional Commits规范
    • 如果变更内容过多,建议拆分生成多条提交信息,每条对应一部分文件

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:
    )之后,首字母应大写,除非是函数名这类符号