Git · Senior · Question 14 of 76

A teammate force-pushed and your main diverged. What is the safest recovery?

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.

Further reading

Problem with a question

Git · Senior · question 14

Test yourself

Take the Git · Senior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz