It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Want to revert a commit, however, get error message from git

Receive the following error when I try to revert a commit:

git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=manager-st revert --no-edit cc158e3f4f17dd49ef0c75ecd7f9c449e52307f8


error: commit cc158e3f4f17dd49ef0c75ecd7f9c449e52307f8 is a merge but no -m option was given.

fatal: revert failed

 

The reason for this revert attempt is that I merged the wrong branch into the current branch.  So before the revert, I reset (In Source Tree) a few of the files back to their previous commit, and discarded all of the items from my working copy, however, this didn't cleanup history, so I tried reverting the commit, but received the above error.  

Is there a way that I can clean up the history or revert the changes back to what they were originally?

2 answers

0 votes
minnsey Atlassian Team Jul 21, 2017

Hi

I'm afraid SourceTree fro Windows does not support the '-m' option for reverting a merge. You will need to run that manually form the Terminal, see https://git-scm.com/docs/git-revert

I had to create a custom Action that then I was able to apply on a commit.  The action was Git revert -n -m 1 $SHA.  I was not able to get rid of the history though.  So I ended up creating a tag (using a new name) for the last good commit for that branch and pushed it.  This was Followed by creating a new branch off the branch I just tagged, and gave it a differnt name, and finally closed the original branch and started using the new branch.

Suggest an answer

Log in or Sign up to answer
TAGS
Community showcase
Published in Sourcetree

Sourcetree for Windows - CVE-2019-11582 - Remote Code Execution vulnerability

A vulnerability has been published today in regards to Sourcetree for Windows.  The goal of this article is to give you a summary of information we have gathered from Atlassian Community as a st...

4,917 views 0 12
Read article

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you