How do you recover a deleted repository or branch on GitHub?
IntermediateProductionRecovery and incident handling
Answer
A deleted branch tied to a PR can be restored from the PR page. A deleted repo can be restored by an org owner within 90 days from the settings (for repos that were not forks with downstream forks), or by contacting support. Always keep a mirror backup for anything critical.
More on Recovery and incident handling
Someone force-pushed over main and 12 commits vanished. How do you recover?IntermediateAfter recovery, what do you change so a force-push to main cannot happen again?AdvancedA bad migration commit was deployed. Walk through your response in the first 15 minutes.IntermediateHow do you find who or what pushed a specific commit to a protected branch?AdvancedCI is red on main after a merge. What is your policy?IntermediateA teammate rebased a shared branch and now everyone has duplicate commits. How do you repair it?Advanced