Git fixup is magic (and Magit is too)

What the trick actually is
It has been reported that some developers are scared by the very notion of rebasing. Understandable. But a rebase is, in practice, nothing mystical — it's just a sequence of cherry-picks that can be massaged with git rebase --interactive. That interactive mode opens a transient todo file you can edit, and if you sprinkle your commits with messages beginning with fixup! or squash! and then run git rebase --autosquash, Git will do the heavy lifting and fold your new fixes into the targeted past commits.
Automating the dance
Want to fix the third-to-last commit without manually editing todo lists? Create a fixup commit with git commit --fixup HEAD~2 (or echo the right fixup! message yourself), then run git rebase -i --autosquash HEAD~3. No keyboard gymnastics. And if you truly want zero prompts, use true as your editor — the tiny no-op program — so the rebase runs unattended. Little pieces, strung together: interactive rebase, autosquash, and a do-nothing editor. Neat trick. Who knew "true" could be useful beyond shell one-liners?
Magit does the heavy lifting for you
Enter Magit, the Emacs Git client that many users swear by. Magit exposes commands like magit-commit-instant-fixup to pick a historical commit to amend and magit-rebase-edit-commit to mark a past change editable. It has been reported that these flows make the whole process feel like you’re editing a living history rather than fighting with an immutable ledger. The emotional payoff is real — there’s joy in a tidy history.
Why this matters
Clean histories matter for code reviews, bisects, and collective sanity. This combo — fixup commits, --autosquash, and Magit’s UI — turns an arcane workflow into something almost pedestrian. So next time you hesitate before rebasing, ask yourself: do you really want to wrestle with git, or would you rather let the tools do the choreography?
Sources: arialdomartini.github.io, Lobsters
Comments