this post was submitted on 06 Oct 2025
829 points (96.7% liked)

Programmer Humor

26799 readers
2408 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 2 years ago
MODERATORS
 

Yeah learned this the hard way.

you are viewing a single comment's thread
view the rest of the comments
[–] ElectricWaterfall@lemmy.zip 3 points 3 days ago (1 children)

I’ve even recovered from deleting local changes I forgot how but there is a way! (It’s not something to rely on but can help in a pinch!)

[–] Ephera@lemmy.ml 7 points 3 days ago (1 children)

Well, if you did commit it, but just hadn't pushed it yet, and then somehow lost that commit, then git reflog would be the tool for it.
Without a commit, sometimes you may have already staged some changes for an upcoming commit and can roll back to that.

But if neither of those are the case, then I can't really imagine how Git should help you there. You haven't told Git about those changes yet, so it's out of scope.
At that point, you better hope your editor's undo history goes back far enough...

[–] ElectricWaterfall@lemmy.zip 2 points 3 days ago

This might have been what it was as you mentioned git reflog. I don’t remember clearly since I’m usually pretty good at not making this mistake.