Skip to content

Instantly share code, notes, and snippets.

@trey
Last active August 29, 2015 14:05
Show Gist options
  • Save trey/9fca1108815a65287b34 to your computer and use it in GitHub Desktop.
Save trey/9fca1108815a65287b34 to your computer and use it in GitHub Desktop.
git checkout good-branch
git branch -D master

Big -D is a blow-everything-away command, make sure this is what you want! You could alternately create a new branch off of the existing master for safe keeping and then delete master.

git checkout -b master

Create a new master based on the current branch and check it out

git branch -d good-branch

Delete the old branch since your master is now the same as that branch

Then, when you push it to a remote, you'll need to --force it to override the master that's there.

git push origin master --force
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment