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?

1 answer

1 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: http://stackoverflow.com/questions/3528245/whats-the-difference-between-git-reset-mixed-soft-and-hard)

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?

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Published May 30, 2018 in Sourcetree

Tip from the team: configuring Git or Mercurial in Sourcetree

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...

549 views 1 2
Read article

Atlassian User Groups

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!

Find my local user group

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

Groups near you