Search code examples
gitgit-mergegit-revert

Git: remove latest commit and previous merge


I want to remove the latest (pushed) commit and the previous merge as well.

this is how my git-tree currently looks like:

enter image description here

This is what I want:

enter image description here

I can't find a solution to this exact tree-problem, and I don't want to screw anything up. So I thought I'd be better off asking for help.

I'm using GitKraken as well, so a GUI-based solution would be as sufficient as a command-line based.

Thanks in advance.


Solution

  • I would try to reset master to masterCommit2 and push master with force flag.

    git switch master
    git reset --hard masterCommit2
    git push --force origin master