Forums

Articles
Create
cancel
Showing results for 
Search instead for 
Did you mean: 

How do I revert push in sourcetree?

Kati Fanomezantsoa
I'm New Here
I'm New Here
Those new to the Atlassian Community have posted less than three times. Give them a warm welcome!
August 17, 2023

I accidently pushed after pulling from staging. Now, I try to revert those changes but then I got the error below:

 

error: commit [hash] is a merge but no -m option was given.

fatal: revert failed

 

Does anyone know how we can solve this?

 

Thank you for your assistance!

1 answer

0 votes
Martin Runge
Community Champion
August 1, 2026

Hi @Kati Fanomezantsoa

Welcome to the Atlassian community!

I would run git revert -m 1 <merge-commit-hash>, in the terminal, then push from Sourcetree as normal.

Sourcetree's Reverse commit cannot do this, because Git needs to be told which parent of the merge to keep. -m 1 keeps the branch you merged into and undoes what came in from the other side.

One thing to watch: reverting a merge blocks those commits from coming back if you merge that branch again later. You would need to revert the revert at that point.

Cheers, Martin

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events