Dash Dash - 1 year ago 45
Git Question

Are there any real differences between using "fixup!" or "squash!"?

I've been reading git documentation on commit and rebase, but I still don't understand the difference between using

as a prefix for the commit message when doing a
rebase --autosquash
. I believe I understand what
does in terms of fixing previous commits, but I fail to see a good example where
is used instead. Can anyone clarify the difference between the two and give some context where they would be used differently? Thanks in advance!

Answer Source

As I illustrated in "Trimming Git Commits/Squashing Git History", and to summarize:

with the fixup! directive, you could keep that squashing "invisible" in the commit message, while still benefiting from the automatic commit reordering with the --autosquash option

As the Op Dash comments:

Using squash! will guarantee that the squashing operation is recorded in the history, which is unlike fixup! where the squash operation is invisible for a more "cleaner" approach.