I'm looking for a way to remove an "double" commit I accidentally created on a repo. While attempting to collapse a branch's commits before merging it into the master, I unwittingly pushed the branch's changes onto the master (I know just enough Git to shoot myself in the foot). Later, when I merged the branch, I ended up with a second (merge) commit. The changes in this merge commit are exactly the same as those in the accidentally pushed commit. Now my master commit history looks something like this:
Some_Newer_Stuff_Here
The_Merge_Commit
The_Branch_Commit //Same contents, different Hash as commit above
Master_Commit_2
Master_Commit_1
I have attempted to use git interactive rebase (as detailed here and here), however when I do so, not all the commits appear in the list. Instead I see something like this:
Some_Newer_Stuff_Here
The_Branch_Commit
Master_Commit_2
The_Merge_Commit is missing (which I assume is the one I want to keep). Note that all commits do show up in git log
. If I attempt to remove The_Branch_Commit using rebase
it creates a bunch of merge conflicts.
I can't find any way to solve this problem, so any help would be appreciated.