Git · Senior · Question 14 of 76
A teammate force-pushed and your main diverged. What is the safest recovery?
- ✓Correct answer: Fetch, then rebase your own commits onto the new tip
- 2Delete your local clone and start working again
- 3Force-push your version back right away to restore it
Explanation
Your old commits are in the reflog; git rebase --onto origin/main <old-base> moves only your own commits. Then agree on branch protection to prevent it next time.