Reputation: 610
The image illustrates my merge history, including a merge that I had done prior to several more recent commits. Can I undo this merge, while keeping the commits that I have done after? I merged with develop when I should have merged with master.
Upvotes: 2
Views: 112
Reputation: 18129
You can try
git revert -m 1 <sha1>
where <sha1>
is the merge commit you want to get rid of.
Described here: https://mijingo.com/blog/reverting-a-git-merge
Upvotes: 1
Reputation: 1994
In theory, you could first run git log
to get a list of commits. Then, you would run git checkout
to a different branch (if you don't have one, use git branch <branch name>
to create. Finally, run git reset --hard <commit ID for your commit of interest>
. This will permanently undo your merge commit since the point you choose.
Upvotes: 1