git rebase --interactive --keep-empty is the scalpel. But git rebase --interactive --empty=keep—the “lean rebase” in modern Git—takes it further. It keeps your essential commits, strips noise, and rewrites history with surgical precision.
A lean rebase does more than squash or drop. It lets you keep empty commits for documentation or CI triggers while removing the junk that bloats your history. The result is a repository log that reads like a deliberate sequence of actions, not the chaos of trial and error.
To use Git rebase lean:
git rebase --interactive --empty=keep main
Choose which commits to edit, squash, or drop. Preserve the ones that matter—even if they have no file changes. Delete meaningless checkpoints. Write commit messages that explain your intent, not just your state.