commit-all

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

Commit All

全部提交

Collect every change on the current branch into one commit with a generated message. No push, no
--amend
, no new branches, no history rewriting: the skill produces exactly one commit on the branch the user is already on, or stops to ask.
Only the user triggers this skill: never activate it from a description of finished work, and never invoke it from another skill. When the user supplies their own commit message, commit directly without this skill.
Arguments:
/commit-all
commits;
/commit-all dry-run
prints the file list and the generated message without committing.
将当前branch上的所有变更合并为一个带有自动生成commit message的commit。 不执行push,不使用
--amend
,不创建新branch,不重写提交历史:该skill只会在用户当前所在的branch上生成一个commit,否则会停止并询问用户。
仅由用户触发该skill:切勿根据已完成工作的描述自动激活它,也切勿从其他skill中调用它。当用户提供自定义commit message时,直接执行提交,无需使用该skill。
参数:
/commit-all
执行提交;
/commit-all dry-run
打印文件列表和自动生成的message,但不执行提交。

Workflow

工作流程

  1. Survey the tree. Run
    git status --short
    ,
    git diff
    ,
    git diff --staged
    , and
    git log --oneline -10
    for the branch's message conventions. A clean tree ends the run with "no changes to commit" and nothing else.
  2. Check the branch. On
    main
    or
    master
    , stop and ask whether to commit there or create a branch first; never commit to a default branch silently.
  3. Separate the session's changes from pre-existing ones. Compare the tree against the
    git status
    from the start of the conversation. Without that snapshot, ask whether to commit everything. By default
    commit-all
    means all changes on the branch; when part of the tree is clearly another topic, say so in one sentence and let the user decide.
  4. Screen untracked files. Skip anything
    .gitignore
    should have covered, one-off scripts, and files that may hold secrets; ask about them instead of staging blindly.
  5. Generate the message. One imperative summary line up to ~72 characters. Reuse a prefix convention (
    feat(scope):
    ,
    fix:
    ) only when
    git log
    shows one; never impose your own. Add a body only when the diff spans several unrelated groups: 2-4 short bullets, one per group, no per-file listing. Write the message in English. No co-author or agent attribution unless the repository's conventions require it.
  6. Show before committing. When the tree holds changes the session did not make, print the file list and the generated message and wait for confirmation. In
    dry-run
    mode, stop here always.
  7. Commit. One commit on the current branch. Afterwards show
    git log -1 --stat
    (or a short excerpt). Do not push.
  1. 检查工作区。运行
    git status --short
    git diff
    git diff --staged
    以及
    git log --oneline -10
    ,以遵循分支的message约定。若工作区干净,则输出“no changes to commit”并结束流程。
  2. 检查分支。若当前是
    main
    master
    分支,停止操作并询问用户是直接提交还是先创建分支;切勿静默提交到默认分支。
  3. 区分会话期间的变更与已有变更。将当前工作区状态与会话开始时的
    git status
    快照进行对比。若没有该快照,则询问用户是否提交所有变更。默认情况下,
    commit-all
    指提交分支上的所有变更;若工作区中存在明显属于其他主题的变更,用一句话说明并让用户决定。
  4. 筛选未跟踪文件。跳过
    .gitignore
    应忽略的文件、一次性脚本以及可能包含敏感信息的文件;针对这些文件询问用户,而非盲目暂存。
  5. 生成提交信息。生成一条不超过约72个字符的命令式摘要行。仅当
    git log
    显示存在前缀约定(如
    feat(scope):
    fix:
    )时,才复用该约定;切勿自行强加约定。仅当diff包含多个不相关的变更组时,才添加正文:2-4条简短项目符号,每个变更组对应一条,不列出单个文件。提交信息使用英文书写。除非仓库约定要求,否则不添加协作者或agent署名。
  6. 提交前确认。若工作区包含非本次会话产生的变更,打印文件列表和自动生成的message并等待用户确认。在
    dry-run
    模式下,始终在此步骤停止。
  7. 执行提交。在当前branch上创建一个commit。完成后显示
    git log -1 --stat
    (或其简短摘录)。不执行push。

Mechanics

操作细节

  • Pass the message via
    git commit -F -
    with a heredoc, never
    -m
    with escaping.
  • Argument order matters:
    git commit -F - -- <paths>
    ; putting
    -F
    after the pathspec breaks.
  • zsh does not word-split an unquoted variable, so
    git diff -- $PATHS
    silently matches nothing; keep path lists in a file or a shell array.
  • For a partial commit use
    git commit -F - -- <paths>
    so already-staged index entries (renames in particular) survive untouched.
  • Never pass
    --no-verify
    ; a failing pre-commit hook is a result to report, not an obstacle.
  • Force push and history rewriting are out of scope for this skill under any wording.
  • 通过
    git commit -F -
    结合 heredoc 传递message,切勿使用
    -m
    参数(避免转义问题)。
  • 参数顺序至关重要:
    git commit -F - -- <paths>
    ;若将
    -F
    放在路径规范之后会导致命令失效。
  • zsh不会对未加引号的变量进行分词,因此
    git diff -- $PATHS
    会静默匹配不到任何内容;请将路径列表存储在文件或shell数组中。
  • 若要执行部分提交,使用
    git commit -F - -- <paths>
    ,这样已暂存的索引条目(尤其是重命名操作)会保持不变。
  • 切勿传递
    --no-verify
    参数;若预提交钩子(pre-commit hook)执行失败,需向用户报告该结果,而非绕过它。
  • 无论何种情况,force push和提交历史重写都不属于该skill的处理范围。

Amend

修订提交(Amend)

When the previous commit was made by this same session and is not pushed, offer
--amend
in one sentence; run it only after the user agrees. Never offer it for a pushed or foreign commit.
若上一个commit是由本次会话生成且尚未推送,用一句话向用户提议使用
--amend
;仅在用户同意后执行该操作。切勿对已推送或非本次会话生成的commit提议使用
--amend