What is the difference between squash and fixup in an interactive rebase?
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
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 onlyWhat 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."