Hi,
I have 3 branches in my working repo : master, A and B. I intended to create a pull request from B to A, but accidentally created the pull request from B to master and merged.
The pull request contains commits B1, B2 and B3 (actually there were many commits in the pull request which is difficult to handpick). Before the pull request merge, the master was at commit M1. If I look at the commit history in master now, i see the following:
- merge commit ID
- B1
- M1
- B2
- B3
I want to reset the master branch to the M1 commit with all the commits included in the pull request being deleted. Is this possible?
Appreciate your help!
Thanks,
Veena
A merge creates a new commit on master. In order to revert those changes, you can use "git revert" on that merge commit.
https://mijingo.com/blog/reverting-a-git-merge has a good example.
Also, keep in mind that the revert also creates another commit. You can merge it back by reverting the revert!
Thanks Jobin.
I was using sourcetree and did Reverse commit (I think this is same as git revert command). I got some error saying that was a merge commit.
I did a reset to the to the previous commit (M1) and did force push. This deleted all the commits associated with the merge and retained all previous the commits pushed to master.
Thanks for your help
-Veena
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.