Here we have 2 branches: master and feature

  * (feature) commit 2
  * commit 1
 /
* (master) initial commit

Merge Strategies

git merge feature

git merge feature —no-ff

git merge feature —squash

git log —oneline —graph —all

* (master, feature) commit 2
* commit 1
* initial commit
* (master) Merge branch 'feature'
|\
| * (feature) commit 2
| * commit 1
|/
* initial commit
* (master) Squashed commit of the following:
| * (feature) commit 2
| * commit 1
|/
* initial commit

git log —oneline

(master, feature) commit 2
commit 1
initial commit
(master) Merge branch 'feature'
(feature) commit 2
commit 1
initial commit
(master) Squashed commit of the following:
initial commit

Resources