http://stackoverflow.com/questions/2427238/in-git-what-is-the-difference-between-merge-squash-and-rebase
Both git merge --squash
and git rebase --interactive
can produce a "squashed" commit.
But they serve different purposes.
will produce a squashed commit on the destination branch, without marking any merge relationship.
This is useful if you want to throw away the source branch completely, going from (schema taken from SO question):
X stable
/
a---b---c---d---e---f---g tmp
to:
X-------------------G stable
/
a---b---c---d---e---f---g tmp
and then deleting tmp branch.
replays some or all of your commits on a new base, allowing you to squash (or more recently "fix up", see this SO question), going directly to:
stable
X-------------------G tmp
/
a---b
If you choose to squash all commits of tmp (but, contrary to merge --squash
, you can choose to replay some, and squashing others).
So the differences are: