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
Accepted answer

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
Published Oct 23, 2018 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...

841 views 3 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