Git - Collaboration WorkflowsIf 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 protectionBDelete the main branch and recreate itCForce push the previous state without notifying the teamDIgnore the push since it will not affect the workflowCheck Answer
Step-by-Step SolutionSolution:Step 1: Identify corrective measuresReverting the commit restores main's state and enforcing protection prevents repeats.Step 2: Evaluate other optionsDeleting main or force pushing without communication risks data loss; ignoring is unsafe.Final Answer:Revert the commit on main and enforce branch protection -> Option AQuick Check:Revert and protect to fix mistakes [OK]Quick Trick: Revert bad commits and protect branches [OK]Common Mistakes:Force pushing without team awarenessDeleting main branch unnecessarilyIgnoring workflow violations
Master "Collaboration Workflows" in Git9 interactive learning modes - each teaches the same concept differentlyLearnWhyDeepVisualTryChallengeProjectRecallTime
More Git Quizzes Cherry-Pick and Advanced Merging - Cherry-picking multiple commits - Quiz 11easy Cherry-Pick and Advanced Merging - Why cherry-pick is useful - Quiz 14medium Git Configuration and Aliases - Global vs local configuration - Quiz 3easy Rebasing - Why rebasing creates linear history - Quiz 10hard Remote Repositories - Why remotes enable collaboration - Quiz 3easy Remote Repositories - git remote add origin - Quiz 13medium Remote Repositories - Fetch vs pull difference - Quiz 14medium Remote Repositories - git pull to download and merge - Quiz 4medium Tagging - Pushing tags to remote - Quiz 14medium Tagging - Semantic versioning with tags - Quiz 1easy