Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
Deleted user
0 / 0 points
badges earned

Your Points Tracker
  • Global
  • Feed

Badge for your thoughts?

You're enrolled in our new beta rewards program. Join our group to get the inside scoop and share your feedback.

Join group
Give the gift of kudos
You have 0 kudos available to give
Who do you want to recognize?
Why do you want to recognize them?
Great job appreciating your peers!
Check back soon to give more kudos.

Past Kudos Given
No kudos given
You haven't given any kudos yet. Share the love above and you'll see it here.

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

how should i remove push commit from sourcetree ?

I am using source tree. By mistakenly, i select 'reverse commit…' from my last commit. I don't want that commit to be pushed on server. How should i do that?

3 answers

1 accepted

15 votes
Answer accepted

Hi Bhushan,

If you select the log entry to which you want to revert to then you can click on "Reset <branch> to this commit". Only use this option if you didn't push the reverse commit changes. If you're worried about losing the changes then you can use the soft mode which will leave a set of uncommitted changes (what you just changed). Using the mixed resets the working copy but keeps those changes, and a hard will just get rid of the changes entirely. Here's some screenshots:

Hope that helps, if not, feel free to ask more questions.

(EDIT: Just to add to that, there's a really good, understandable explanation of soft/mixed/hard modes here:

Thanks! This helped me a lot with another issue

hi @Kieran Senior [Atlassian] , If I pushed the commit to remote server, Then what should I do in case, I want to revert the commit or soft reset the commit. as you say *Only use this option if you didn't push the reverse commit changes*. Thanks in advance.

I don't have this option on my right click menu. Is is Mac only? Does it only appear if the branch is called "master"? Something else?

Same question as @Md. Kauser Ahmmed - What if I already committed and pushed once or twice and I want to disregard both of those pushed commits and revert to a earlier point? What steps should be take in Atlassaian Sourcetree?

Good question, Kevin.  Seems you've been left hanging.  I, too, have done this "reset to to this commit" and what happens is my local repo resets but then I am now X number of commits behind the remote branch.  And sourcetree won't let me overwrite them.  I want to remove the commits after the commit I reset to.  Period.  Remote and all.  Why is this hard?

Like # people like this

Hello I know they're old comments, but in response to @Md. Kauser Ahmm @Kevin Williams @Scott Kallen . I just had this issue, saw this and noticed there's no answer here... I just found out to do this, you reset your local branch to the commit you want, as mentioned in article above. Then you push and check the "Force" check box. The force checkbox is greyed out by default in SourceTree because it's dangerous. You need to enable it in the Source tree options - git - Enable force push. Source tree could really do with a tooltip when hovering over the greyed out "force" checkbox to tell you this.

For me the force push went through fine and the branch was in the same place local and remote. Obviously only do this if the remote branch past the commit you want to keep only contains the commits you want to delete and not if other people have been working in it since.



Like # people like this

Exactly what I was looking for. Thanks

I think I have already used Mike's solution sometimes, but I can't get it to work now.

In SourceTree I can do the reset, but the forced push bumps. It effectively does nothing.

Then I am left with 2 different heads.

The only remaining option seems to pull to synchronise again, then reverse commit and push that.

This is so FRUSTRATING. I am the only user and I just want knock out a single commit.

I don't seem to be able to do that in GitHub either.

Like # people like this

This helped me remove a commit that I needed to remove in order to move forward. Thank you!

Thanks @Mike_Robinson. It worked for me

Suggest an answer

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

Tip from the team: configure your repos for hosting goodness!

Supported Platforms macOS Windows We recently introduced support for additional hosting services such as GitHub Enterprise, GitLab (Cloud, Community Edition, Enterprise Edition), and...

3,347 views 4 5
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