Git Fast-forward
A fast-forward happens when the branch you merge into has no new commits of its own. Git simply moves the branch pointer forward to the other branch's latest commit.
No merge commit is made, so the history stays a straight line. Use --no-ff if you want a merge commit anyway.
A fast-forward merge
git merge emergency-fix
Updating 90fe82c..b4d3923
Fast-forward
index.html | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
Always make a merge commit
git merge --no-ff new-feature -m "Merge branch 'new-feature'"
Merge made by the 'ort' strategy.
index.html | 1 +
1 file changed, 1 insertion(+)
git log --oneline --graph -3
* 72df4ee (HEAD -> main) Merge branch 'new-feature'
|\
| * 8205048 (new-feature) Added feature
|/
* 6682b7d Merged conflict-demo, kept W3Schools heading
|\