BeginnerPhone
2 min
Git Fast-Forward vs --no-ff
GitVersion Control
Advertisement
Interview Question
What is a fast-forward merge in Git, and when would you use --no-ff?
Key Points to Cover
- Fast-forward: branch pointer moves without a merge commit
- `--no-ff` forces a merge commit to preserve branch history
- Use `--no-ff` to keep feature history for audits/reverts
Evaluation Rubric
Correctly defines fast-forward34% weight
Explains --no-ff behavior33% weight
Gives valid usage scenarios33% weight
Hints
- 💡Think: linear history vs preserving branch context.
Common Pitfalls to Avoid
- ⚠️Not clearly distinguishing between a fast-forward merge (pointer move, no new commit) and a non-fast-forward merge (new commit, two parents).
- ⚠️Failing to articulate the specific benefits of preserving merge history, such as for auditing, simplified reverts, or clearer workflow visibility.
- ⚠️Confusing the `--no-ff` strategy with `git rebase` and not explaining their distinct impacts on history.
- ⚠️Not mentioning that fast-forward merges are the default behavior when possible, making `--no-ff` an explicit override.
- ⚠️Providing a generic explanation without detailing the specific conditions that allow or prevent a fast-forward merge.
Potential Follow-up Questions
- ❓How does squash merge differ?
- ❓When would you prefer rebase instead?
Advertisement