Reputation: 13026
What exactly is the difference?
My goal is to completely restore the working tree to the state when it says "no changes" - no modifications or deletions, no new untracked files, nothing.
I don't care about the .gitignore-ed files.
Upvotes: 4
Views: 2836
Reputation: 150755
If you want to discard all uncommitted changes:
git reset --hard head
Which will basically restore all the files that Git knows about to their last committed state.
If you want to remove all the files that Git does not know about:
git clean -dxf
This will delete everything that is ignored or not tracked.
Upvotes: 9
Reputation: 29369
git-reset
Reset current HEAD to the specified state.
for eg: git reset --hard HEAD^
- this will remove the top commit
git-clean
Used to remove untracked files/directories from working directory
Upvotes: 5