In SourceTree, how to go back to previous commit and delete new files?

So before I upgraded a third party plugin in my project to their newest version, I did a commit so I could reverse the changes if things went haywire. Well, things went haywire and I'd like to restore the project to the state it was at with the last commit. I tried 'Reset master to this commit' but it seems to have kept some of the new files added when I upgraded the plugin even though I selected hard (discard local changes). There's many files, so manually deleting the problem files would be tiresome (why I made sure to commit before upgrading).

Anything I can do in SourceTree?

edit: does removing files in SourceTree delete them?

2 answers

So I was able to browse Uncommitted Changes and delete the files that had been added. Seems to have solved my problem, but I'll still give credit for the answer if someone provides a cleaner solution.

Try the "stash" feature. Stashing (untracked files must be staged when using sourcetree, I believe) will leave you with a clean working copy up to your last commit. If you decide you want your changes back, you only need to apply the stash. If you want to discard your changes, you can just drop/delete the stash.

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

227 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