Merging – linear vs. non-linear history (Git)

After developing a feature or fix you want to merge that branch onto the parent branch. There are two main different approches: One creates a linear and the other a non-linear history.


Scenario

          c1b0---62d8 [feature]
         /
e73a---6cfa---90ed [develop]

Linear history

Rebasing before the merging, without creating a merge commit.

Result

e73a---6cfa---90ed---c1b0*---62d8* [develop]

* Those commit hashes are actually different, because of the rebase.


Non-linear history

Merging without rebasing before, creating a merge commit.

Result

          c1b0---62d8 [feature]
         /           \
e73a---6cfa---90ed---2e1g* [develop]

* This is the merge commit, necessary because of the missing rebase.