Matthew Berman
Matthew Berman

Reputation: 8631

How do I delete a branch I created and revert everything back to the master branch's last commit?

The last commit I made to the master branch is where I want to get everything back to. I made a lot of changes and committed them to a new branch I created called omniauth. I would like to delete this branch entirely and restore everything back to the last master commit. How do I do that?

Upvotes: 0

Views: 63

Answers (1)

Mark Longair
Mark Longair

Reputation: 467181

First you can switch back to the master branch with:

git checkout master

Then you can delete the omniauth branch with:

git branch -D omniauth

Note that the -D option (as opposed to the safer -d) will delete the branch regardless of whether the commits in that branch have been merged into your current branch.

Upvotes: 1

Related Questions