branch-discipline
Branch Discipline — Always Return to Main After Feature Work
Section titled “Branch Discipline — Always Return to Main After Feature Work”After finishing work on a feature/bug/refactor branch (committed, pushed, PR merged), you MUST: switch back to the primary branch (main, or the worktree’s intended branch) → pull (git fetch && git pull --ff-only) → delete the merged branch locally with git branch -D (-D not -d: squash-merge produces a new SHA, so git’s ancestry check reads the branch as “not merged”) → verify git status --short is empty → confirm in the report: “back on main, working tree clean.”
Worktree exception: if the branch has a + prefix in git branch, it is in active use in a worktree — DO NOT delete it. Report as “in worktree, left untouched.”
Full worked example, multi-kit loop, and “when NOT to delete” cases: docs/branch-discipline.md.
Stale local branches cause the next git pull --ff-only to fail (local has commits main doesn’t), masking that work was already merged.