Search code examples
gitgit-commitgit-revert

How to delete a pushed git merge commit


I merged a couple of devel commits into the master branch of my repo just to find out that GitAhead screwed up the master at some point.

Now I tried various methods described on SO in order to undo these commits (there is no other commit than merges on master). This way master was indeed reset to an earlier version.

However, I still have the full merge history in headless branches (the grey path on the image):

enter image description here

I tried to revert, reset, etc the branch without success alas!

How can I fully delete the commits (c518859ce4, 7574f10f68)?


Solution

  • The problem is the tag on the first commit. It is keeping the ghost commits alive.

    Get rid of the tag and checkout your reset master (which I presume is somewhere further down the chart). Your history will then look correct.