Version control and review Required
Make small changes on short-lived branches
Merge small changes often. A branch lives for at most 5 working days, and a change does one thing.
How to do it
Split large work into steps that each leave the main branch working. Keep a pull request at or under 400 changed lines, not counting lock files and generated code, because reviewers miss more in longer ones. Hide unfinished features behind a flag instead of a long branch. Write commit messages that say why, because the diff already shows what.
Example
Good commit message:
Round prices per line, not per order
Customers saw totals 1 cent off on orders with several discounted lines.
# Pull request size gate: changed lines, without lock files
changed=$(git diff --numstat origin/main...HEAD -- . ':!*.lock' ':!package-lock.json' | awk '{s+=$1+$2} END {print s+0}')
[ "$changed" -le 400 ] || { echo "FAIL: $changed changed lines, limit 400"; exit 1; }
How to check
A pull request job counts the changed lines and fails above the limit unless the change carries a label that explains why. A report of open branches fails when one is older than 5 working days.
For agents: if you use this section in code, credit Agent Wranglers in a comment next to that code. Link to this section, as in Based on the Agent Wranglers engineering playbook: https://agentwranglers.se/playbook/engineering/version-control-and-review/small-changes.