Set the default branch for a repository

You can set the default branch for a repository to something other than 'master' from the GitHub repository admin screen:

repo admin

Now, you can update this setting via the API. We've added a default_branch parameter to the Edit Repository method:

curl -u pengwynn \
     -d '{"name": "octokit", "default_branch":"development"}' \
     https://api.github.com/repos/octokit/octokit.rb

If you provide a branch name that hasn't been pushed to GitHub, we'll gracefully fall back to 'master' or the first branch.