Taming the 'WIP' Noise: Using Interactive Rebase for Review-Ready History
Stop polluting your pull requests with 'WIP' commits. Learn how to use git rebase -i to squash, fixup, and reword your history for cleaner code reviews.
24 Sept 2025, 17:10 UTC

The Problem: The 'WIP' Commit Trail
During active development, it is common to commit frequently to save progress. This often results in a commit history littered with messages like "WIP", "fixing typo", or "trying again". While these are helpful for the developer in the moment, they create noise during peer code reviews. Reviewers have to sift through redundant changes to understand the actual intent of the feature, making the process slower and more prone to missing critical bugs.
The solution is git rebase -i (interactive rebase). This tool allows you to rewrite your local commit history—combining small fixes into logical units and refining messages—before the code ever reaches the main branch.
How Interactive Rebase Reshapes History
Interactive rebasing works by taking a series of commits and "replaying" them one by one onto a specified base. During this process, Git opens a text editor (your configured core.editor) containing a list of commits. Each commit is prefixed with a command that tells Git how to handle it:
- pick: Use the commit as is.
- reword: Use the commit, but change the commit message.
- edit: Stop for amending the commit's contents.
- squash: Combine the commit into the previous one and merge the messages.
- fixup: Like squash, but discard this commit's message.
- drop: Remove the commit entirely.
Worked Example: Condensing a Feature Branch
Assume you are on a feature branch with five commits, and the last three are minor fixes to the first two logical changes. You want to condense these into two clean commits.
- Initiate the rebase: Run the following command in your terminal. This targets the last five commits relative to your current position (HEAD).
git rebase -i HEAD~5 - Modify the todo list: Your editor will open with a list. To combine the "WIP" commits into the main feature commits, change the commands as follows:
Note:pick a1b2c3d Implement user authentication pick e4f5g6h Add database schema fixup i6j7k8l Fix typo in schema fixup m9n0o1p Update schema constraints fixup q2r3s4t Fix linting in auth logicfixupis used here instead ofsquashbecause the WIP messages provide no value to the final history. - Complete the process: Save and close the editor. Git will apply the changes. If no conflicts occur, the process finishes automatically.
- Verify the result: Check your history to ensure the five commits have been reduced to two.
git log --oneline
Trade-offs and Safety Constraints
Rewriting history is a powerful operation, but it comes with risks regarding collaboration and data integrity.
The Danger of Shared History
Rebasing changes the unique SHA-1 hashes of your commits. If you have already pushed these commits to a remote server and other developers have pulled them, your rewritten history will diverge from theirs. This can cause significant merge conflicts for your teammates.
Rule of Thumb: Only rebase commits that exist solely on your local machine or on a private feature branch where you are the only contributor.
Force-Pushing Safely
Because the remote history and local history now differ, a standard git push will be rejected. You must force the update. To avoid accidentally overwriting work a colleague might have pushed to your branch, use --force-with-lease instead of --force:
git push origin feature-branch --force-with-lease
--force-with-lease checks that the remote ref is where you expect it to be before overwriting.
Handling Rebase Conflicts
If you reorder commits or drop a commit that a later commit depends on, Git will pause. You must resolve the conflict in the files, stage them with git add <file>, and then run:
git rebase --continue
If the rebase becomes too complex, you can return to the original state using git rebase --abort.
Actionable Workflow for Safety
To minimize risk, adopt this sequence before performing a complex rebase:
- Create a safety tag:
git tag backup-before-rebase. This gives you a permanent pointer to your current state. - Perform the interactive rebase:
git rebase -i HEAD~n. - Test the build: Ensure the rewritten history didn't accidentally introduce a regression.
- Push with lease:
git push origin <branch> --force-with-lease. - Cleanup:
git tag -d backup-before-rebase.
0 replies
A thoughtful contribution can make all the difference. Be the first to share one.