- Add SKILL.md (50 lines) managing branch/worktree lifecycle, rebase/squash integration, and evidence-first recovery - Add references/worktrees.md for worktree creation, locking, and clean removal - Add references/history-editing.md with conflict halt and abort guardrails - Add references/recovery.md for evidence-first reflog diagnosis and non-destructive branch restoration
1.5 KiB
1.5 KiB
History Editing
Rules for rewriting or combining history. Read before any of these operations.
Squash
- Do it to collapse noise (checkpoint or fixup commits) into one coherent change.
- Don't squash a meaningful sequence (foundation, feature, tests, docs) into one giant commit.
Rebase
- Fine on local, unshared branches, to keep history linear and tidy before integrating.
- Never rebase or force-push a branch others may have pulled without my explicit OK.
- On conflicts: stop immediately. Inspect
git status --shortand conflicting hunks. Never guess resolution. Offergit rebase --abortto return cleanly to prior state if resolution is uncertain.
Cherry-pick
- Inspect the source commit and what it depends on.
- Confirm the target working tree is clean.
- Cherry-pick, inspect the resulting diff, run validation.
- On conflicts or hidden dependencies: stop and report. Offer
git cherry-pick --abort.
Merge
- Follow the repo's integration policy (merge commit vs fast-forward vs rebase).
- Keep merge commits when the branch shape tells a useful story (long-running feature work).
- On conflicts: stop and report. Offer
git merge --abortbefore attempting resolution.
Reset and restore
- Safe (keeps file contents):
git restore --staged <file>,git reset --soft <ref>. - Destructive (discards work):
git restore <file>,git reset --hard,git clean -fd,git push --force. - Never run a destructive command without telling me exactly what would be lost and getting an explicit yes.