Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

You missed the point of the '--hard' argument. It destroys the local, uncommitted changes.

That can be much scarier than 'git push -f'.



Apparently we both need to write better, because you missed the point of my example. Most—if not all—local changes that would be destroyed by git reset --hard show up in git status.

git clean -dfx will wipe out ignored files, which do not show up in git status, so it's much easier to forget about something you meant to keep.


I've never used 'git clean -dfx' routinely during development. On the other hand, I've seen a colleague lose a few hours' work by forgetting to commit a specific file out of a set, and then doing 'git reset --hard' for some reason. 'git status' didn't save him. Luckily, he did commit the corresponding tests file.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: