91
submitted 22 hours ago by mat@jlai.lu to c/programmerhumor@lemmy.ml

As the title says. I put the wrong value inside a clean up code and I wiped everything. I did not push any important work. I just want to cry but at least I can offer it to you.

Do not hesitate to push even if your project is in a broken state.

top 37 comments
sorted by: hot top controversial new old
[-] wheezy@lemmy.ml 4 points 2 hours ago* (last edited 2 hours ago)

I did a "rm -rf *" in the wrong directory today.

I got the absolutely beautiful "argument list too long" in return.

I had a backup. But holy shit I'm glad the directory had thousands of files in it and nothing happened. First time I got that bash error and was happy.

I usually have rm aliased to "trash" or whatever that cli based recycle bin is. But just installed a new OS and ran this on a NAS folder today by mistake.

[-] LovableSidekick@lemmy.world 23 points 14 hours ago
IN CASE OF FIRE

1. git commit
2. git push
3. exit building
[-] 69420@lemmy.world 2 points 3 hours ago

Except when everyone pushes to main at the same time and now you have conflicts.

[-] 18107@aussie.zone 13 points 8 hours ago* (last edited 8 hours ago)

git-fire

"git-fire is a Git plugin that helps in the event of an emergency by switching to the repository's root directory, adding all current files, committing, and pushing commits and all stashes to a new branch (to prevent merge conflicts)."

[-] bhamlin@lemmy.world 2 points 9 hours ago
  1. git commit -m 'asdf'
[-] billwashere@lemmy.world 3 points 11 hours ago

I have this printed on a sign at work.

[-] some_guy@lemmy.sdf.org 2 points 11 hours ago

Time to implement a couple forms of backups.

[-] rolling_resistance@lemmy.world 11 points 16 hours ago

Sorry this happened.

Use it as an opportunity to learn how to better store and edit your code (e.g. a VCS and a smart-ish editor). For me, a simple Ctrl-Z would be enough to get my code back.

[-] mat@jlai.lu 1 points 5 hours ago

I should have put it inside the post text but I used a wrong value inside a test

[-] einkorn@feddit.org 33 points 20 hours ago

No backup, no mercy.

[-] mhzawadi@lemmy.horwood.cloud 42 points 22 hours ago

git commit, git push, git out

[-] MSBBritain@lemmy.world 7 points 20 hours ago

I need a t-shirt that says this.

This is a programmers mic drop.

[-] HelloRoot@lemy.lol 4 points 15 hours ago

You guys don't use a COW (copy on write) filesystem?

[-] lauha@lemmy.world 9 points 15 hours ago

Version control would be quite adequate if using a sane amount of time between pushes

[-] sxan@midwest.social 4 points 12 hours ago

Except that one is automatically versioned and would have saved you this pain, and the other relies on you actively remembering to reflexively commit, and then do extra work to clean up your history before sharing, and once you push, it's harder to change history and make a clean version to share.

These days, there's little excuse to not use COW with automated snapshots in addition to your normal, manual, VCS activities.

[-] HelloRoot@lemy.lol 3 points 15 hours ago* (last edited 15 hours ago)

I'm paranoid. I have like 5 different ways (including 3-2-1 backups) to restore everything. COW fs is great for stuff that is not a git-able project.

[-] fibojoly@sh.itjust.works 4 points 15 hours ago

What did you learn from this?

[-] mat@jlai.lu 1 points 5 hours ago* (last edited 5 hours ago)

To push daily and to not write test :P

[-] Cratermaker@discuss.tchncs.de 5 points 17 hours ago

If you're using vscode you might be able to look through the individual file histories to recover some work.

[-] PeriodicallyPedantic@lemmy.ca 13 points 21 hours ago

Sympathy upvote

[-] Valmond@lemmy.world 13 points 21 hours ago

Ya, push push push baby, do it on your own branch so that you can find your way back if needed.

Especially when refactoring.

[-] ravermeister@lemmy.rimkus.it 4 points 21 hours ago* (last edited 21 hours ago)

I always like to say "push it to the limit" and then I have this homer Simpson with muscle body sitting on his super couch (I forgot which TV series the Simpsons made Satire of) picture in my head 🀣

Update, hah found it😁 https://m.youtube.com/watch?v=7Mhb9D35pkc&pp=ygUdc2ltcHNvbnMgcHVzaCBpdCB0byB0aGUgbGltaXQ%3D

[-] tias@discuss.tchncs.de 5 points 19 hours ago

I keep my git clone in Dropbox so I can revert accidental delete and always have the most recent code on all devices without having to remember to commit and push. If it requires manual execution I wouldn't really consider it a proper backup solution.

[-] dave@feddit.uk 2 points 13 hours ago

I have been burnt by Dropbox in the past so now use Syncthing between my desktop, laptop, and a private remote server with file versioning turned on. Trivial to global ignore node_modules, and not giving data to a third party.

It's saved me on several occasions.

[-] blackbirdbiryani@lemmy.world 1 points 12 hours ago

I use Dropbox too. Though I have to admit, when running code you sometimes have to pause sync otherwise it interferes with code execution. But definitely worth the peace of mind. Sometimes you don't want to commit stuff until you're sure that it works.

[-] anti_antidote@lemmy.zip 2 points 16 hours ago

Sounds like you need Jujutsu πŸ₯°

[-] meme_historian@lemmy.dbzer0.com 7 points 21 hours ago

Do you at least have some local commits to get back to? Or did your job remove the .git folder as well? πŸ‘€

[-] mat@jlai.lu 7 points 19 hours ago
[-] MyNameIsRichard@lemmy.ml 3 points 19 hours ago

You have backups? Right?

[-] ReversalHatchery@beehaw.org 1 points 16 hours ago

what garbage cleanup tool gets rid of dotfiles, especially .git? if you let us know we can learn to avoid it

[-] mat@jlai.lu 1 points 5 hours ago

shutil.remove_tree(BASE_DIR) instead of shutil.remove_tree(TEMP_DIR) inside of tear down code

[-] msherburn33@lemmy.ml 1 points 12 hours ago

On top of that, the content of .git/objects/ is write protected, so even if you go rm -r, you'll get an additional warning.

[-] Vince@lemmy.world 5 points 21 hours ago

Oh man, I hate losing code. Last time it happened I spent more time trying to recover it than it would've taken to rewrite it.

[-] victorz@lemmy.world 2 points 15 hours ago

You can't just... replace your baby, man!

[-] lefaucet@slrpnk.net 3 points 18 hours ago
[-] Aganim@lemmy.world 2 points 17 hours ago

On the bright side, you've now got squeaky clean disk space to fill with new projects!

[-] Mist101@lemmy.world 3 points 20 hours ago

I have a separate usb harddrive for just this occasion. My lazy ass just likes to play "We backed it up last time, do we need to do it every time?

this post was submitted on 03 Jul 2025
91 points (93.3% liked)

Programmer Humor

36975 readers
253 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS