Interview Prep/Git & GitHub/Merge, rebase and cherry-pick

What is the difference between a fast-forward merge and a merge commit?

BeginnerConceptMerge, rebase and cherry-pick
Answer

A fast-forward happens when the target branch has no new commits since the feature branched, so Git just moves the branch pointer and no new commit is created. Otherwise Git creates a merge commit with two parents. --no-ff forces a merge commit even when a fast-forward is possible, preserving the feature's grouping in history.

git merge --ff-only feature
git merge --no-ff feature
All Git & GitHub questions Roadmap: Git & GitHub

More on Merge, rebase and cherry-pick