Find commits in a reverted merge

I did a merge of a unfinished branch to master. I did a revert merge to reverse the code changes.

Now the problem is I cannot merge this particular branch again to master. So what I plan to do now is to create a new dummy branch and cherry pick the lost commits and put it in the new branch and merge the above branch to the newly created branch and resume development from the newly created branch. This would work.

  • How not to forget to add files
  • How can I re-merge commits that were reverted in github?
  • Adding ignore files to git repo retroactively
  • Git Autocompletion looks weird (and only half-functional)
  • Unable to normalize line endings for Git in Visual Studio Project
  • that pulls in non-Python github repos and puts them in the correct directory?
  • My question is is there a neat way of achieving the same in git?

    I don’t want to do a revert of revert.


  • What will break if I don't have a git master branch?
  • Git - working on wrong branch - how to copy changes to existing topic branch
  • Git: Push to a remote repository with a message
  • Add syntax highlighting to gh-pages
  • How to incorporate WordPress automatic updates with Git as version control?
  • git: import changes from non git repository
  • 2 Solutions collect form web for “Find commits in a reverted merge”

    Your second merge is not working because git understands that it is already merged.

    What you say about the cherry pick is an option. I propose you to use rebasing instead of cherry pick.

    git checkout dev
    // do your staff
    git add .
    git commit -m "Finish the work"
    git rebase master

    With this, you regenerate all the history of your dev branch again from the last position of master branch. And git will now allow you to merge it.

    Except the cherry-picking, which you probably should do, there is a tricky way to make git think the branch still not merged – replace the merge commit with identical non-merge commit.

    git replace --edit <merge commit>

    In the editor open the will be text like

    tree AAAAA
    parent BBBB
    parent CCCCC
    author ...

    Then remove the second “parent ” line (with CCCC), save, exit. Now the merge commit will be seen to git as simple commit, and the branch can be merged again.

    The replacement can be removed after second merge.

    Git Baby is a git and github fan, let's start git clone.