🔀 The Fixup Commit That Rebase Never Noticed Was There
Autosquash automatically reorders and folds commits whose message starts with a fixup or squash marker followed by the exact subject line of the commit they target, which lets you commit a small correction and have it silently fold into the right earlier commit during an interactive rebase. The matching is literal string matching against the target’s current subject line, so if that commit’s subject gets edited after the fixup was created, autosquash finds no match at all, and the fixup commit stays exactly where it was committed: a separate, oddly-named commit sitting in your history instead of being folded into the one it was meant to fix.
🔎 The Problem
$ git log --oneline a1c2d3e Add retry logic to payment client ... $ git commit --fixup a1c2d3e # Creates: "fixup! Add retry logic to payment client" # Later, before the rebase, the earlier commit's message gets amended # for clarity: $ git commit --amend -m "Add retry logic and backoff to payment client" $ git rebase -i --autosquash HEAD~5 # autosquash looks for a commit whose subject is EXACTLY the original # text to attach the fixup to. That exact subject no longer exists - # the fixup commit is left standing alone, unmarked, in the generated # todo list, and the rebase proceeds with both commits still separate.
✅ Fix: Reference the Commit Hash, and Recheck After Any Amend
- Create the fixup commit by passing the target commit’s hash directly rather than typing the target’s subject line by hand – letting Git read the subject straight from the commit object avoids any chance of a typo breaking the match.
- If a commit gets amended or reworded after fixups already exist for it, recreate those fixup commits against the new commit before running the autosquash rebase, since autosquash matches against the current subject line, not whatever it was when the fixup was first created.
- Before finishing an interactive autosquash rebase, scan the generated todo list for any commit still showing a literal fixup or squash prefix on its own line – that is the exact signal autosquash did not find a match for it, and it needs manual reordering instead of being left as its own permanent commit.
⚠️ Why This Is Easy to Miss
- Creating the fixup by commit hash always works correctly because it copies the subject line verbatim – the failure mode only appears once someone constructs the fixup message by hand or reorders history between creating the fixup and running the rebase.
- The rebase completes without any error or warning when a fixup commit goes unmatched – it just becomes an ordinary extra commit in the result, which looks like a normal, if slightly oddly-named, part of history unless you are specifically checking for a leftover marker.
Autosquash does not know what you meant to fix – it only knows whether two subject lines are, character for character, still the same.

