Bird
0
0

A developer accidentally commits directly to main without code review in trunk-based development. What is the best corrective action?

medium📝 Troubleshoot Q7 of 15
Git - Collaboration Workflows
A developer accidentally commits directly to main without code review in trunk-based development. What is the best corrective action?
ARevert the commit on main and apply changes through a feature branch
BDelete the main branch and recreate it
CForce push an older commit to main to erase the change
DIgnore the commit since it is on main
Step-by-Step Solution
Solution:
  1. Step 1: Identify safe correction for direct commit

    Reverting the commit preserves history and allows proper review by reapplying changes via feature branch.
  2. Step 2: Compare options

    Revert the commit on main and apply changes through a feature branch is safe and recommended. Other options risk data loss or ignoring process violations.
  3. Final Answer:

    Revert the commit on main and apply changes through a feature branch -> Option A
  4. Quick Check:

    Fix direct commit = revert and reapply properly [OK]
Quick Trick: Revert bad commits, then fix properly [OK]
Common Mistakes:
  • Force pushing to erase commits
  • Deleting main branch
  • Ignoring process violations

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Git Quizzes