Files
skills/skills/git-manager/references/history-editing.md
T
kiskaadee 383fcf3db6 feat(git-manager): unify git-commit and git-workspace into git-manager
- Archive skills/git-commit to archive/skills/git-commit and document in archive/README.md
- Evolve skills/git-workspace into skills/git-manager (66 lines <= 80)
- Add references/commits.md covering slice boundaries, staging discipline, Conventional Commit depth matching, pre-commit gate, and session-mode execution
2026-10-31 20:51:52 -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.