Bird
0
0

If a developer accidentally pushes directly to the main branch against workflow rules, what is the best corrective action?

medium📝 Troubleshoot Q7 of 15
Git - Collaboration Workflows
If a developer accidentally pushes directly to the main branch against workflow rules, what is the best corrective action?
ARevert the commit on main and enforce branch protection
BDelete the main branch and recreate it
CForce push the previous state without notifying the team
DIgnore the push since it will not affect the workflow
Step-by-Step Solution
Solution:
  1. Step 1: Identify corrective measures

    Reverting the commit restores main's state and enforcing protection prevents repeats.
  2. Step 2: Evaluate other options

    Deleting main or force pushing without communication risks data loss; ignoring is unsafe.
  3. Final Answer:

    Revert the commit on main and enforce branch protection -> Option A
  4. Quick Check:

    Revert and protect to fix mistakes [OK]
Quick Trick: Revert bad commits and protect branches [OK]
Common Mistakes:
  • Force pushing without team awareness
  • Deleting main branch unnecessarily
  • Ignoring workflow violations

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes