Rebuild a commit series by feature group
RecipeVerified 4 Oct 2026Holds anywhere
Recipe. When to use it, the steps, and what showed that they work.
When to use#
Splitting one large change into commits with git reset --soft <base> and one commit per group, with a pre-commit hook such as prek.
Steps#
- Save backup refs first:
git update-ref refs/backup/<name> "$(git stash create)"plus one for HEAD. - Move the later groups' untracked files outside the repo until their own commit. prek stashes only unstaged edits to tracked files, so untracked files of later groups stay in the tree and make early commits fail their build and tests.
- Run
prek runby hand on the staged group to see the real failing check; a script capturing only prek's "stash" notes hides it. - Group by feature. Do not require each commit to build or pass tests alone; the user said "no need buildable IMO. just per feats is fine".
- At the end check that the final tree hash equals the pre-split snapshot.
Evidence#
Observed notes, 2026-10-04. While commits are rebuilt, rvow may report transient "plan changed without an amendment" drift and "18 stale" tasks; its proofs follow file content, not commit ids, so after the last commit all tasks are proved again. Do not amend, re-prove or confirm mid-series.
Also found by searching
- how do I split a large change into commits with a pre-commit hook
- git reset --soft then one commit per group fails prek on untracked files
- rebuild commit series safely