Interview Q&A / Git & GitHub

IntermediateQuick answer1 min readUpdated 3 Oct 2026

What is the difference between squash and fixup in an interactive rebase?

SHORT ANSWER

Both merge a commit into the one above it. squash lets you combine and edit the two commit messages, while fixup silently discards the second message and keeps the first as it is.

Explain it simply

Suppose you commit 'Add cart page' and later 'oops, forgot a semicolon'. The second commit is a correction, not a real step. Fold it in.

With squash, Git stops and shows both messages so you can write a combined one; useful when both commits carry meaning. With fixup, the message of the small correction is thrown away; ideal for typo and lint fixes. You can create them ready-made: git commit --fixup <hash> makes a commit labelled for that target, and git rebase -i --autosquash places and marks it automatically.

Example

bash
git commit --fixup 5d6e7f8
git rebase -i --autosquash HEAD~5
# list shows: fixup <new commit> placed under its target
# squash = keep and edit both messages
# fixup  = keep first message only

What to say in the interview

"Both fold a commit into the previous one. squash combines the messages for me to edit, fixup drops the folded commit's message. I use fixup for small corrections and git commit --fixup with --autosquash to automate placement."

#git#rebase#squash

Related questions

Practise more Git & GitHub questions

Test your recall with short answers, then return to the detailed explanations when you need context.

Open Git & GitHub quick answers →

Get new questions like this by email

One short email when something new and useful lands. No spam, unsubscribe in one tap.

By subscribing you agree to the Privacy Policy.