Sync with the tracked upstream, stage everything, read the diff, write a good commit message, and commit.
Steps
Inspect state and sync:
git status --short --branch, then resolve the tracked upstream withgit rev-parse --abbrev-ref --symbolic-full-name "@{upstream}".- If an upstream exists, run
git pull --rebase --autostash. - If the pull, rebase, or autostash fails or leaves unmerged paths (
git diff --name-only --diff-filter=U), stop without staging/committing and report the recovery state. - If no upstream is configured, skip the pull and say so.
- If an upstream exists, run
Verify there are changes after pulling:
git status --porcelain. If empty, stop and say so.Stage all changes:
git add -A.Read the staged diff for context:
git diff --cached --statandgit diff --cached.Write the message:
- Subject: concise, imperative, ≤50 chars. Conventional Commit prefix optional.
- Body (when the change is non-trivial): blank line, then wrapped lines explaining what and why, not how.
Commit with a real multi-line message:
git commit -m "$(cat <<'EOF' <subject> <body line> <body line> EOF )"Confirm with
git log -1 --statandgit status --short --branch.
Rules
- Plain text only — no markdown, code fences, or quotes inside the message.
- Group unrelated changes into one coherent message; don't list every file.
- Don't add
Co-Authored-Byor tool attribution unless asked. - Never bypass a failed pull or unresolved conflict to create the commit.
- Never
git push— committing only.