Remove Pushed File from Branch


I recently accidentally push .gitignore into my branch, but didn't want to even commit it. After floundering for a while and running a lot of sourcetree functions to try to change where my origin is, I'm still not able to reset the orgin to a version that doesn't have .gitignore pushed. I've made a pull request already to merge this branch into master, and I'm not sure if that affects how I can change the branch here. Here's a photo of what my status looks like, I'd like the origin to be reset where the bugfix is.

Screen Shot 2017-07-19 at 9.36.26 AM.png

1 answer

1 accepted

0 votes
Answer accepted

You can "Reverse" your commit and get all your changes reverted to as it were on the previous version. 

Right click on the commit row to select "Reverse commit".


I wasn't able to do that before because I had a pull request open and a merge was in progress regarding that commit. Once I closed the pull request I was able to reverse the commit.

Suggest an answer

Log in or Sign up to answer
Community showcase
Posted Jan 17, 2019 in Sourcetree

[dev team] Sourcetree for Windows 2019 Preview - Dark Theme

Hi folks, While the full post is over on our blog I'd like to share the dark theme we've got planned for 2019 here directly as well to keep the discussion going.  The ...

793 views 10 10
Join discussion

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