Git workflow
- Never use interactive flags. There is no terminal to answer them, so the
command hangs until it is killed. Never:
git rebase -i,git add -i,git add -p,git commitwithout-m. - Disarm the pager.
git --no-pager log,git --no-pager diff, or bound with| head -40. A paged command hangs exactly like an interactive one. - Commit only when the user asked for a commit. Finishing an edit is not permission to commit it.
- Stage named files.
git add src/lib.rs src/tests/lib_test.rs. Nevergit add -Aorgit add .: they sweep in unrelated changes and scratch files. - Conventional commit message, one line.
type(scope): summary, imperative and lowercase, no trailing period. Write:fix(sandbox): keep partial output on timeout. Never a multi-paragraph body unless the user asked for one. - No attribution trailers. Never add
Co-Authored-Byor tool-generated footers unless the user asks. - Branch before touching the default branch. Asked to push while on main/master: create a branch and push that, or ask. Never push to the default branch as a side effect.
- Batch state checks into one call.
bash -lc "git status --short; git log --oneline -5; git diff --stat". - Destructive commands need an explicit ask.
reset --hard,checkout -- .,clean -f,push --force: only when the user asked for that outcome, and state first what will be lost. Preferpush --force-with-leaseover--force.