What hash commit cancels clicked merge with git-revert?

I merged a beta branch into a leading branch. I went to the origin. Now I want the wizard to be the same as before the merge, both locally and remotely.

A good answer canceling a merge that has already been clicked suggests

git revert -m 1 commit_hash 

If this is true, how can I define commit_hash ? I unsuccessfully tried the hash returned by merge-base :

 $ git merge-base --all master beta 1f4b949b7ef97abf913ae672e3acd0907abfac1b $ git revert -m 1 1f4b949b7ef97abf913ae672e3acd0907abfac1b error: Mainline was specified but commit 1f4b949b7ef97abf913ae672e3acd0907abfac1b is not a merge. fatal: revert failed 

I reviewed both git-log and gitk versions of branches, but they are very long, and I am not confident enough in my interpretation to feel that I have to ask for help before making a possible bigger mess. Beta was obtained from v2, which was obtained from the master. Merging with the master in v2 and beta testing occurred as I updated new branches with the master. Merging from beta to master was a bug that I want to fix.

Once I determine the merge point, if I find any commits made on master after the merge that really should be on the beta branch, what's the best way to move them?

+7
source share
2 answers

You need to find a merge commit, git merge-base tells you the commit where you can perform the merge. This is basically the last commit that exists in these two branches. Merge negotiation only exists in your main branch, unless you have created a new branch after the merge, but that doesn't matter. :)

To find a merge attempt, follow these steps: git log master ^beta --ancestry-path --merges

The required commit is the last commit.

But please read the letter from Linus: http://www.kernel.org/pub/software/scm/git/docs/howto/revert-a-faulty-merge.txt

+4
source

Also see http://sethrobertson.github.com/GitFixUm/ , which will miss almost any git problem, including clicked merges. However ... pressed merges do not have a simple solution.

+1
source

All Articles