goldfrapp04 goldfrapp04 - 1 year ago 406
Git Question

How to discard uncommitted changes in SourceTree?

I'm new to the Git environment, and I'm using BitBucket with SourceTree on Mac. All I want to do now is to discard the changes since last commit. How should I do this? I haven't found anything like "discard changes", and directly pulling from the last commit doesn't seem to work. Solutions done with either the GUI or command line will be good. Thank you.

Max Max
Answer Source

I like to use

git stash

This stores all uncommitted changes in the stash. If you want to discard these changes later just git stash drop (or git stash pop to restore them).

Though this is technically not the "proper" way to discard changes (as other answers and comments have pointed out).

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download