Skip to content

Instantly share code, notes, and snippets.

@j8
Created September 21, 2014 23:40
Show Gist options
  • Save j8/b365ef1507aae5653be7 to your computer and use it in GitHub Desktop.
Save j8/b365ef1507aae5653be7 to your computer and use it in GitHub Desktop.
Delete master branch and re-create it from existing branch
git branch -m master master-old # rename master on local
git push origin :master # delete master on remote
git push origin master-old # create master-old on remote
git checkout -b master OTHERBRANCH # create a new local master on top of OTHERBRANCH
git push origin master # create master on remote
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment