Approach (goal: make reviewable while preserving meaningful history)- Ask the author to collapse the 120 WIP commits into a small set of logical commits (1–6) that each represent a single coherent change (e.g., "add X feature", "refactor Y", "fix concurrency bug"). Explain that this improves reviewability and git history while keeping important milestones.Practical steps I’d request / perform1. Create a backup branch so nothing is lost:bash
git checkout -b feature/branch-backup
2. Interactive rebase to fold WIP commits into logical commits (author does this):bash
git checkout feature/branch
git rebase -i origin/main # mark WIP commits as squash/fixup into logical commits
# or use: git rebase -i --autosquash <base>
3. Use "fixup!" for trivial fixes and "squash!" for cases needing combined messages. After rebase, force-push:bash
git push --force-with-lease origin feature/branch
Suggested squashed commit message (example)Title: Implement X feature; refactor Y; fix ZBody:- Implement core X functionality (adds X service, endpoint /x)- Refactor Y to extract shared utilities (files: a.py, b.py)- Fix race condition in Z by adding mutex in z_handler- Tests: add unit tests for X, add integration test for Z- Notes: follow-up cleanup planned in separate PR (issue #123)Preserving important history- Keep any semantically meaningful commits separate (e.g., migration, API contract changes) instead of squashing them away.- If some intermediate WIP commits contain useful debugging info, move that info into the combined commit message or use git notes to preserve raw snapshots:bash
git notes add -m "debug logs: ... " <commit>
- Encourage the author to include references to issue/PR numbers and short rationale in commit messages so intent survives squashing.Review workflow alternatives if author can’t rewrite- Use a local temporary branch to create a clean squashed branch for review only:bash
git checkout -b review-squash origin/feature/branch
git reset $(git merge-base review-squash origin/main)
git add -A
git commit -m "Squashed review commit: ... (see original branch for raw commits)"
- Use GitHub/GitLab features: "Changes from last review", file filters, or diffing tools (git range-diff) to compare logical chunks.Why this approach- Reduces cognitive load for reviewers (small, focused commits)- Preserves intent via good messages and separate commits for distinct concerns- Keeps original work recoverable via backup branch or git notes- Uses standard git workflow (interactive rebase + force-with-lease) and provides fallback for teams that forbid history rewritesEdge notes- Always ask permission before force-pushing shared branches.- Suggest a short contribution guideline: "squash WIP locally; keep meaningful commits; write one-line title + 3–5 bullet message."