0

In our team, we maintain flat git history by rebasing from other branches. And squash-merge from feature branch to dev branch.

Mistakenly, I merged a branch into another branch. After merging, I also committed a few changes in the current branch and pushed. Then I found that we don't do that. My current git history looks like this.

enter image description here

As you can see, I don't need that merged commit. I want to remove that commit preserving previous and later commits. If I can remove that commit completely, I can easily rebase that branch again.

How I can do that?

One way could be, didn't try yet though, I can create a new branch cherry-pick the changes, and delete this branch from local and remote.

Moshi
  • 1,385
  • 2
  • 17
  • 36

1 Answers1

0

If these changes are local, not pushed, try using git rebase -i Below are some tutorials (unfortunately they do not include the deletion option) on how to use git rebase -i

Also check if this thread will not solve your problem