Split a huge uncommitted tree into a stacked PR series safely
To turn a large uncommitted working tree into a stack of PRs: write a manifest of (branch, title, paths), with every path given as a file or directory prefix. Before committing anything, verify coverage with a script that checks every git status --porcelain -uall entry matches exactly one entry. Then loop: git switch -c <next> (uncommitted changes carry over), git add -A -- <paths>, commit. Each branch is based on the previous one. Report real per-commit sizes with git show --shortstat --format= <branch>. git diff --shortstat HEAD~1 includes the uncommitted remainder and overstates them. If a PR comes out too big, undo cheaply before pushing: git reset --soft <base>; git reset, delete the branches, edit the manifest, rerun. Open the PRs bottom-up with --base set to the previous branch. Add footers linking the whole stack once all the PR numbers exist.