Member-only story

Git Fast-Forward Explained on GitLab

Simplify Complexity
1 min readJul 26, 2021

A personal development branch has two ways to get merge to the master:

a. Fast-Forward
b. Merge Commit

Merge Commit

Suppose your development branch has 3 commits: c1, c2 and c3. On merge to master, git will create a new `merge commit`.

commit 0abcdefghgtkbkbsvbevkjbevb7877
Merge: 32324hbuyyc
Author: Who am I <who.am.i@xyz.com>
Date: Thu Jul 01 01:01:38 2021 +0000
Merge branch 'a_development_branch' into 'master'

This is usually the merge request title

See merge request src/myrepo!2345

Other commits (c1, c2 & c3) are merged at the “right” chroniclogical order in the commit log. A sample log might look like following:

<merge commit>
<some_other_commit>
<c1>
<another_commit_from_someone>
<c2>
<c3>

Fast-Forward

The repo must be rebased with the master. Then git applies all commits in the repo and adds them to the commit log.

The commit log may look like the following:

<c1>
<c2>
<c3>
<merge commit>
<some_other_commit>
<another_commit_from_someone>

I personally prefer fast-forward because all of the commits of dev branch are together. There is no extra commit log entry for each merge to master.

--

--

Simplify Complexity
Simplify Complexity

Written by Simplify Complexity

Golang, Distributed Systems, File Systems, Python, C/C++, Linux

No responses yet