Yeah learned this the hard way.
You know… A version control system… That class of software that makes it possible for you to recover from any error you commit.
yeah, the whole thread is junior af
- Use git for any code you write. Yes, even a simple script.
 - Commit and push often. More often than you think is reasonable. You can always rebase / fixup / squash / edit but you can’t recover what you didn’t commit.
 - ???
 - Profit.
 
Seriously, once you commited something to the repo it’s hard to lose it. Unless you delete
.git. But a this point frequent pushing has your back.I know git can be hard to grasp in the beginning. It was hard for me too. I highly encourage everyone to put in the effort to understand it. But if you don’t want to do that right now just use it. Just commit and push. It will pay off.
With Jujutsu (which is compatible with git), you can just
jj undoGit repository operations are (almost?) always recoverable.
git reflogis your friend.The filesystem operations are another story. Handle with care.
Wait, what does reflog do?
Think of it like your browser history but for Git. It’s a list of the SHAs related to your recent operations.
And because Git is a content-addressable data store, a SHA is basically like a URL. Even if a branch no longer exists, if you know the SHA it pointed to then you can still check out the exact contents of that branch. The reflog helps you find that.
Goddamit… It’s ref log, not re flog. I thought this was related to blame and never touched it lmao

I guess “git sanasaryan-han-torture” was an overkill sometimes…
git reflog
git re-flog is what you do with those idiots who mess up the repo so that someone else has to come in and fix it again.
Reflog, when flogging isn’t enough.



