You can create a branch using Create Link in the API part. I am not sure, however, if you can create an orphan branch with this or if the API will prevent this.
In fact, testing with curl does not work:
curl -X POST -u sigmavirus24 https://api.github.com/repos/sigmavirus24/github3.py/github3.py/refs -d '{"ref":"refs/heads/orphaned"}' curl -X POST -u sigmavirus24 https://api.github.com/repos/sigmavirus24/github3.py/github3.py/refs -d '{"ref":"refs/heads/orphaned", "sha":""}'
Both are returning:
{"message": "Reference update failed"}
I tried with and without the Content-Type header ( -H "Content-Type: application/json" ), but did not work.
From this insignificant experiment, it seems you cannot create an orphaned branch through the API.
source share