What is fast-forward commit?

A commit B is said to be a fast-forward from another commit A if and only if commit A is found in the history of commit B. In other words, commit B is just commit A with some more commits applied onto it.

Example of a fast-forward commit

In the example below, branch_b (aka Fifth commit) is a fast-forward from branch_a:


branch_a
First commit
Second commit
branch_b
First commit
Second commit
Third commit
Fourth commit
Fifth commit

Example of a non-fast-forward commit

In the example below, branch_b is not a fast-forward from branch_a because An oddball commit is not in the history of branch_b:


branch_a
First commit
Second commit
An oddball commit
branch_b
First commit
Second commit
Third commit
Fourth commit
Fifth commit

To get branch_a to become a fast-forward from branch_b, you could rebase it on top of branch_b like so:

git checkout branch_a 
git rebase branch_b 

Once you do this, you will have all of branch_b’s commits in your history, and your own branch_a commits applied after those.