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

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 Join to answer
Community showcase
Brian Ganninger
Published Jan 23, 2018 in Sourcetree

Tip from the team: workflow and keyboard shortcuts

Supported Platforms macOS Sourcetree has a lot to offer and, like many developer tools, finding and using it all can be a challenge, especially for a new user. Everyone might not love ...

261 views 0 3
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
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot