Files
skills/skills/git-workspace/references/history-editing.md
T
kiskaadee 501ec5cd3c feat(git-workspace): add workspace, worktree, integration, and recovery skill
- 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
2026-10-31 09:31:31 -05:00

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 --short and conflicting hunks. Never guess resolution. Offer git rebase --abort to return cleanly to prior state if resolution is uncertain.

Cherry-pick

  1. Inspect the source commit and what it depends on.
  2. Confirm the target working tree is clean.
  3. Cherry-pick, inspect the resulting diff, run validation.
  4. 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 --abort before 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.