Bird
0
0

In a workflow enforcing pull requests for main branch changes, what happens if a developer pushes directly to main?

medium📝 Predict Output Q5 of 15
Git - Collaboration Workflows
In a workflow enforcing pull requests for main branch changes, what happens if a developer pushes directly to main?
AThe local branch is deleted
BThe push succeeds and bypasses code review
CGit automatically creates a pull request
DThe push is rejected due to branch protection rules
Step-by-Step Solution
Solution:
  1. Step 1: Understand branch protection

    Branch protection rules prevent direct pushes to main to enforce reviews.
  2. Step 2: Analyze options

    Only The push is rejected due to branch protection rules correctly describes rejection of direct push; others are incorrect behaviors.
  3. Final Answer:

    The push is rejected due to branch protection rules -> Option D
  4. Quick Check:

    Branch protection blocks direct pushes [OK]
Quick Trick: Protected branches reject direct pushes [OK]
Common Mistakes:
  • Assuming push bypasses review
  • Believing Git auto-creates pull requests
  • Thinking local branches get deleted automatically

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes