git-topic-commit-push
Git Topic Commit Push
Create honest topic commits from the changes the user authorized. Commit and push are distinct actions: a commit-only request does not authorize pushing. Reuse existing explicit authorization instead of asking again for the same action.
Inspect and group
Inspect branch/upstream, status, staged and unstaged diffs, relevant untracked files and recent commit conventions. Preserve the user's existing staged work and unrelated edits; a dirty worktree alone is not a reason to stop.
Use one commit per coherent outcome, splitting only independently explainable changes. Prefer paths or reviewed hunks. If unrelated changes overlap so that a safe commit boundary cannot be established, ask for the smallest needed staging decision.
Stage and commit
- Add only authorized paths or hunks. Do not use a bare
git reset,git add .orgit add -Ato prepare a topic. - Inspect the complete staged diff before each commit: a normal
git commitincludes everything in the index, including previously staged user work. Do not commit that work unless it is authorized; do not unstage it merely for convenience. - Use Conventional Commit types and Chinese subjects/bodies unless the user requests another language. Body detail should explain the outcome, with 2–5 bullets when the change warrants them.
- Pass message text as safe arguments or a UTF-8 message file supported by the current shell. Avoid interpolated multiline shell strings.
For a topic with no unrelated staged changes: