What is the difference between merge –squash and rebase?

I’m new to git and I’m trying to understand the difference between a squash and a rebase. As I understand it you perform a squash when doing a rebase.

4 s
4

Merge commits: retains all of the commits in your branch and interleaves them with commits on the base branchenter image description here

Merge Squash: retains the changes but omits the individual commits from history
enter image description here

Rebase: This moves the entire feature branch to begin on the tip of the master branch, effectively incorporating all of the new commits in master

enter image description here

More on here


The first two diagrams come from About pull request merges on the GitHub Docs

Leave a Comment