Revert a faulty merged branch

If you accidentally merged a feature branch into develop you can use git-revert to undo the merge. But when the time has come to merge the feature branch into develop, git-merge command sees the original merge, and happily announces that all is well and branches have been already merged.

To revert the revert without screwing up your workflow too much:

  • Create a local trash copy of develop
  • Revert the revert commit on the local copy of develop
  • Merge that copy into your feature branch, and push your feature branch to your git server

Your feature branch should now be able to be merged as normal when you’re ready for it. The only downside here is that you’ll a have a few extra merge/revert commits in your history.