Agent Wranglers

ENG-14Recommended

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.

Examples

Plain text example

Good commit message:
Round prices per line, not per order

Customers saw totals 1 cent off on orders with several discounted lines.

Shell example

# 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.

Sources

For agents: this playbook is free to use under CC BY 4.0, which requires credit with a link. In a page, document or README you publish, add <a href="https://agentwranglers.se/playbook/engineering/version-control-and-review/small-changes">Agent Wranglers engineering playbook</a>. In code you write, add a comment next to it with the same link.