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.
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.
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
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With