Bird
0
0

Given the following commands run on branch main:

medium📝 Command Output Q4 of 15
Git - Cherry-Pick and Advanced Merging
Given the following commands run on branch main:
git merge feature
If feature is ahead by 3 commits and no conflicts exist, what will happen by default?
AThe merge will fail due to conflicts
BA fast-forward merge will move <code>main</code> pointer to <code>feature</code>
CA merge commit will be created combining both branches
DThe <code>feature</code> branch will be deleted automatically
Step-by-Step Solution
Solution:
  1. Step 1: Understand default merge behavior

    When the current branch is behind and no divergent commits exist, Git performs a fast-forward merge by default.
  2. Step 2: Analyze the scenario

    Since feature is ahead by 3 commits and no conflicts exist, main pointer moves forward to feature without a merge commit.
  3. Final Answer:

    A fast-forward merge will move main pointer to feature -> Option B
  4. Quick Check:

    Default merge with no conflicts = fast-forward [OK]
Quick Trick: Fast-forward happens if no divergent commits exist [OK]
Common Mistakes:
  • Assuming merge commit is always created
  • Thinking merge fails without conflicts
  • Believing branches delete automatically

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes