You can set the default branch on Github to point at something other than master, but i'll show you how can you swap around a development branch with master while keeping the old in a legacy branch.

A little while ago I started to re-write one of my gems, however, because it was such a drastic re-write, development was done in a brand new branch. So no code existed on this new branch. Finally came to the point where I decided to switch the old gem out for the new one on GitHub, and instantly ran into problems. I couldn't really just merge the development branch into master, as it wasn't originally based off master, so this is what I did...

  1. On the GitHub repo, set the default branch to be the 'dev' branch.
  2. Rename the local branches
    git branch -m master legacy
    git branch -m dev master
  3. Delete the remote master branch on GitHub.
    git push origin :master
  4. Push up the new master to GitHub.
    git push origin master:refs/heads/master
  5. Push up the old legacy code to GitHub.
    git push origin legacy:refs/heads/legacy
  6. On the GitHub repo, change the default branch back to 'master'
  7. Finally, Delete the old remote dev branch on GitHub.
    git push origin :dev

So now you should have the old master branch in a new branch called 'legacy' and the new 'dev' branch as master. Done and done!