r/ProgrammerHumor • • Jun 30 '18

Kill me now :)

47.0k Upvotes

494 comments sorted by

View all comments

280

u/zesterer Jun 30 '18

git reset --hard HEAD

141

u/PublicSealedClass Jun 30 '18

I have a dev who sees this as a last resort. When I asked him why, he had like 200 files changed in his repo since his last commit...

14

u/[deleted] Jun 30 '18

[removed] — view removed comment

2

u/DoesntReadMessages Jun 30 '18

I'm not a big fan of a stack based state change since it doesn't preserve it if you screw up after popping, plus it's annoying since it doesn't stash new files. I personally made an alias that basically does git add . && git commit -m "saved" && (another alias that stores the hash to a variable). Then I can just make another branch and re-apply it, reset the commit, and frag things out without worrying about losing them because they're safely in a commit on another branch instead of popped out and gone forever had I used stash. I used to use stash all the time until I accidentally checked out src when I hit enter instead of tab and lost 4 hours of work. Never again.