Lean Rebase: Crafting Clean, Intentional Git History
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.
This approach is precise. Lean rebase prevents merge commits from creeping in unless explicitly desired. It enforces a linear history without the messy side effects of repeated merges. It keeps git log valuable, git bisect faster, and blame output useful.
When paired with code review, lean rebase is unstoppable. It ensures each pull request tells a clear story, from first line to last. It makes onboarding easier, debugging faster, and releases safer.
Branches do not have to be littered with dead commits and partial fixes. With Git rebase lean, you own the history. You make it sharp, minimal, intentional.
See how clean workflows and lean history improve delivery. Try it in action with hoop.dev and get a live environment running in minutes.