What is the difference between merge --squash and rebase?

Question

I'm trying to understand the difference between a squash and a rebase. As I understand it, one performs a squash when doing a rebase.

Answer

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

Vim for Windows - What do I type to save and exit from a file?

Git Bash is extremely slow on Windows 7 x64