Fast-Forward Merges
A fast-forward merge moves the branch pointer forward. It happens when your line has not moved since the branch started.
Merge a branch that moved alone
Main stood still while the branch grew, so Git moves the pointer forward.
$ git merge add-recipeThe history stays straight
No merge snapshot was made. The line reads straight down.
$ git log --oneline --graphExample
$ git merge add-recipe
$ git log --oneline --graphKey points
- No new snapshot is made.
- The pointer simply moves to the newest snapshot.
- Git prints “Fast-forward” when it does this.
- It is the simplest kind of merge.
- It happens when main stood still while the branch grew.
- A merge snapshot appears only when both lines moved.
Here, main had not moved, so Git moved the pointer forward. No merge snapshot was made.
Try it Yourself
Edit the code, then press Run.
Running is simulated
Exercise
When does Git fast-forward?