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.

  • git word-diff-regex that works with multiline changes?
  • git remote branches listing
  • Rewriting multiple git repos into one
  • How to clean git log when removing unwanted files with BFG Repo-Cleaner
  • Interact with remote Mercurial and Git http repositories
  • git-svn from the point of view of a git native user
  • My question is is there a neat way of achieving the same in git?

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

    Thanks

  • Getting list of SVN users for Subversion -> Git migration?
  • Isolate commit history to specific branch
  • Git: how to see the changes for a file before push - not the diff, the final version
  • git diff current directory as default
  • Github Desktop deleted my files HELP :'(
  • How to pull submodules in .gitmodule?
  • 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.