Pawan
Pawan

Reputation: 32331

How to remove merged content from master

I am using a git repository.

I accidentally merged my master branch with another branch by doing:

git checkout master 

git merge branch_245

But did not do any commit or push, so the merge is just present in my local repository.

Now I don't want to include the contents of branch_245 in my master. How can I undo my merge?

Upvotes: 0

Views: 52

Answers (1)

Zombo
Zombo

Reputation: 1

When you merge Git does a merge commit automatically, unless it cannot or you tell it not to. So in all likelihood you did commit.

Having said that you can git reset back to the previous commit like this

git reset --hard HEAD~1

Upvotes: 2

Related Questions