Bird
0
0

What does the --no-ff option do when merging branches in Git?

easy📝 Conceptual Q11 of 15
Git - Cherry-Pick and Advanced Merging
What does the --no-ff option do when merging branches in Git?
AIt creates a merge commit even if a fast-forward merge is possible.
BIt squashes all commits into one before merging.
CIt deletes the source branch after merging.
DIt aborts the merge if conflicts are found.
Step-by-Step Solution
Solution:
  1. Step 1: Understand fast-forward merges

    A fast-forward merge moves the branch pointer forward without creating a new commit if no divergent changes exist.
  2. Step 2: Effect of --no-ff

    The --no-ff option forces Git to create a merge commit even if a fast-forward is possible, preserving branch history.
  3. Final Answer:

    It creates a merge commit even if a fast-forward merge is possible. -> Option A
  4. Quick Check:

    --no-ff keeps history with merge commit [OK]
Quick Trick: Remember: --no-ff always makes a merge commit [OK]
Common Mistakes:
  • Confusing --no-ff with --squash
  • Thinking it deletes branches
  • Assuming it aborts on conflicts

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes