Quick summary
You can restore a deleted branch in GitHub by navigating to the Pull requests tab and clicking the Restore branch button on the associated closed pull request. This method preserves the full branch history and contents as long as it is performed shortly after deletion.
Steps
- Go to the GitHub repository where you want to restore a deleted branch.
- Navigate to the Pull requests tab in your repository, since the branch was deleted after a pull request was merged.
- Locate the closed pull request that was associated with the deleted branch.
- Find the Restore branch button near the bottom of the pull request and click it to restore the branch.
- Confirm that the branch history and contents remain intact — this is guaranteed if the restore is done soon after deletion.
.gif)



