Does github keep deleted remote branches in history? If so, can those be restored?
Yes, it's possible to restore a deleted branch from git.
Find your Commit ID: Search for a branch using git reflog
If you had the branch in your local git repo within the last 30 days, you may be able to find it in the reflog using the following:
git reflog
Search for the branch name in the reflog and note the HEAD{x}
point or the commit ID.
Re-create the branch from the Reflog HEAD point:
git checkout -b branch_name HEAD@{27}
Re-create the branch from the commit ID:
You can checkout the commit ID and create a branch off of that commit point:
git checkout -b branch_name <commit id>
It is possible to ask for GitHub support and have them look into the reflog
of your remote repo (like in this thread for example).
If this is close enough (less than 30 days per default) from the deletion, the reflog still contains the commits which are no longer referenced by any branch.
Creating a branch on one of those commits allow them to be again accessible.
For more on reflog, see "what the heck is a reflog and why is it so important?"
Update: the repo owner can also query the GitHub EVents API:
See "Does GitHub remember commit IDs?"
When the branch has been deleted for a very long time (in my case, 1 year), but you had opened a pull request for that branch, you may be able to resurrect it by searching in the pull requests history.
Once I found the pull request for that branch I could restore the branch. Relevant commit information, etc. are also available from the pull request.