git -c diff.mnemonicprefix=false -c core.quotepath=false revert --no-edit 33caab3d919b176504aed8ed57edcdd93fd8bc5a
error: Commit 33caab3d919b176504aed8ed57edcdd93fd8bc5a is a merge but no -m option was given.
fatal: revert failed
Completed with errors, see above.
Don't use SourceTree, you'll need to go to the git command line for this.
Undoing a merge is basically similar to undoing any other commit, but there are a few additional complications. If you are lucky enough to catch your erroneous merge before pushing it, you can just use reset --hard. If you've already pushed, or if you're following best practice and doing your commits via Pull Requests, then you'll need to use git revert. But in order to use git revert with a merge commit, you need to use the -m flag to specify which of the commit's parents to use as a baseline.
A merge commit, to Git, is just a commit with two parents. Typically one of them represents the branch you "merged into" (probably the master branch or the development branch, depending on your workflow) and the other represents the branch that you merged (such as a feature branch). But to Git, they are just parent 1 and parent 2.
The "merged into" branch represents your baseline while the "merged" branch represents the changes that you want to revert. It seems like the "merged into" branch is usually P1, but I wouldn't count on this - examine your Git history to determine for sure. If you look at the details of a commit in SourceTree or using the command
git show --pretty=%P <commit>
the first parent listed will always be P1.
Once you've determined which parent is your baseline, the command is
git revert -m <baseline> <commit>
where baseline is the number 1 or 2 (or, rarely, another number for a commit with more than two parents)
git revert -m 1 3
Badges are a great way to show off community activity, whether you’re a newbie or a Champion.Learn more
Supported Platforms macOS Windows To make using Sourcetree as simple yet powerful as possible we embed (bundle) dependencies such as Git, Git LFS, and Mercurial. We strive to keep these...
Connect with like-minded Atlassian users at free events near you!Find a group
Connect with like-minded Atlassian users at free events near you!
Unfortunately there are no AUG chapters near you at the moment.Start an AUG
You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs