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.
This question is related to
On SourceTree for Mac, right click the files you want to discard (in the Files in the working tree list), and choose Reset.
On SourceTree for Windows, right click the files you want to discard (in the Working Copy Changes list), and choose Discard.
On git, you'd simply do:
git reset --hard to discard changes made to versioned files;
git clean -xdf to erase new (untracked) files, including ignored ones (the
d is to also remove untracked directories and
f to force.