If you don't have a local repo anymore (meaning you cannot get your deleted branch through the local git reflog and push it back to GitHub), you still can retrieve (for a limited time, 90 days by default), your deleted branch from the GitHub repo itself.
See the GitHub Events API.
Those events are limited in time, so "all traces and history of it gone?": yes, eventually.
curl https://api.github.com/repos/<user>/<repo>/events
As described in this blog post, you will get a JSON payload which will include any push event you ever made, including your old branch:
"id": "1970551769",
"type": "PushEvent",
"actor": {
"id": 563541,
"login": "<user>",
"gravatar_id": "<id>",
"url": "https://api.github.com/users/<user>",
"avatar_url": "<url>"
},
"repo": {
"id": 9652839,
"name": "<user>/<repo>",
"url": "https://api.github.com/repos/<user>/<repo>"
},
"payload": {
"push_id": 303837533,
"size": 1,
"distinct_size": 1,
"ref": "refs/heads/<branch>", <============================
"head": "a973ddd28d599c9ba128de56182f8769d2b9843b",
"before": "4ef3d74316c04c892d17250f0ba251b328274e5f",
"commits": [
{
"sha": "384f275933d5b762cdb27175aeff1263a8a7b7f7",
"author": {
"email": "<email>",
"name": "<author>"
},
"message": "<commit message>",
"distinct": true,
"url": "https://api.github.com/repos/<user>/<repo>/commits/384f275933d5b762cdb27175aeff1263a8a7b7f7"
}
]
},
"public": false,
"created_at": "2014-02-06T14:05:17Z"
}
You can then fetch, using that specific commit 'a973ddd28d599c9ba128de56182f8769d2b9843b
', make a branch locally and push it back to GitHub!
git fetch origin a973ddd28d599c9ba128de56182f8769d2b9843b:refs/remotes/origin/yourOldBranch
git checkout -b yourOldBranch
git push