Come for the products,
stay for the community

The Atlassian Community can help you and your team get more value out of Atlassian products and practices.

Atlassian Community about banner
4,361,480
Community Members
 
Community Events
168
Community Groups

How can I revert a merge commit in sourcetree

Hi,

I work using pull requests and sometimes they need to be reverted. The command line workflow I use is as documented here: http://tildedave.com/2012/11/24/reverting-a-github-pull-request.html

Basically I create a new branch, find the merge commit SHA and then run

git revert -m 1 SHA

In sourcetree there is the 'Reverse commit...' option, which does a git revert but it will not work on a merge commit because it will not use '-m' (see https://answers.atlassian.com/questions/322559/what-exactly-is-reverse-commit).

How can I use sourcetree to revert a merge commit?

Thanks

1 answer

1 accepted

0 votes
Answer accepted

If you want to do it in SourceTree, you can only do it with a custom action.

I already created a feature request for this, you can vote for it here.

Zero reference for the command to enter into the custom action to actually answer the question?

Script to run:

git

Parameters:

revert -n -m 1 $SHA

(I prefer it not to automatically commit so I can review the changes, hence the -n parameter)

Like # people like this

Thanks it was helpful for me

Suggest an answer

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

Bug Fix: Sourcetree for Windows authentication error when updating to app password

Hello Sourcetree users!!! With the recent removal of Bitbucket Cloud account passwords for app passwords (please see our Bitbucket Cloud community post for details on why we made this change for se...

79,197 views 135 29
Read article

Atlassian Community Events