437
rm -rf / (programming.dev)
submitted 3 months ago* (last edited 3 months ago) by JPDev@programming.dev to c/programmer_humor@programming.dev
all 35 comments
sorted by: hot top controversial new old
[-] db2@lemmy.world 47 points 3 months ago

Is that better or worse than pushing a corrupt C-00000291*.sys?

[-] CosmicTurtle0@lemmy.dbzer0.com 7 points 3 months ago
[-] CanadaPlus@lemmy.sdf.org 5 points 3 months ago

Better. I'm not even sure this is bad, per se. Presumably you're sure your present repo is trash.

[-] Wilzax@lemmy.world 30 points 3 months ago

Why learn how to use the entire swiss army knife when you can keep it closed to use it as a very small hammer?

[-] Barzaria@lemmy.dbzer0.com 25 points 3 months ago

I always use this command as $rm -fr and read it as remove, for real

[-] Ephera@lemmy.ml 12 points 3 months ago

I do write it as rm -rf, but then my brain always continues singing The Lion Sleeps Tonight...

[-] MonkeMischief@lemmy.today 5 points 3 months ago

singing The Lion Sleeps Tonight...

"reeHEEEEEEEEEEEEEE--EE--Eaally ya-sure ya-wan-nadothaaat?"

(rm -rf, rm -rf, rm -rf)

[-] sukhmel@programming.dev 6 points 3 months ago

it's for the French locale

[-] sgibson5150@slrpnk.net 19 points 3 months ago

Hey, sometimes you need to hose out the cruft.

Why yes, I do maintain a legacy application that still stores user files in Program Files in blatent violation of 15 years of Windows best practices and continues to be done contrary to my repeated advice, why do you ask?

[-] reboot6675@sopuli.xyz 18 points 3 months ago

Another one of this kind is rm -rf node_modules && npm install

[-] zqwzzle@lemmy.ca 15 points 3 months ago* (last edited 3 months ago)
[-] SpaceNoodle@lemmy.world 5 points 3 months ago

Nuke the reflog

[-] hperrin@lemmy.world 14 points 3 months ago

What? Why would you need to do this? Is someone fucking with the .git directory?

[-] Ephera@lemmy.ml 16 points 3 months ago

It does sometimes happen that something in there just breaks and isn't easy to recover. But it can also be a matter of (inexperienced) devs just deciding, fuck it, I won't try to merge it, I'll just copy my changes elsewhere and throw away the repo.

[-] nous@programming.dev 8 points 3 months ago

I have never had git get into a state I cannot get out of. Even if that is a reset, checkout or clean. And those are very rare. How are people breaking things so often.

Learn the tools you use daily, it saves you a lot of headache in thelong term.

[-] Ephera@lemmy.ml 6 points 3 months ago

Oh yeah, but I'm talking about the internal Git state just genuinely being broken, for example: https://stackoverflow.com/questions/14448326/git-commit-stopped-working-error-building-trees
Ultimately, if you spend half an hour debugging that, it just starts being a waste of time compared to cloning anew.

As for how to merge, yes, one should learn that. The problem is that the complexity of the code changes adds on top of whatever insecurities you might still have with Git.
I did put "inexperienced" in braces there, because even as an experienced dev, merges are sometimes just not worth doing. In that case, you could just checkout the branch a second time, but well, still not that different.

[-] RobotZap10000@feddit.nl 1 points 3 months ago

Step 1. Forget to push local commits

Step 2. Push commits from another machine

Step 3. Pull from remote om the first machine

I'm a bit of a noob, I often do this when I get too careless.

[-] nous@programming.dev 2 points 3 months ago

That should not break things though. Maybe get a merge conflict that you need to sortout at worst. This is essentially the constant state of working with other people on a project.

[-] RecluseRamble@lemmy.dbzer0.com 6 points 3 months ago

But it can also be a matter of (inexperienced) devs just deciding, fuck it, I won't try to merge it, I'll just copy my changes elsewhere and throw away the repo.

Pretty sure that's actually it. Git has a learning curve and, for example, some naive rebase not working out as intended can be scary if you don't know what you're doing.

[-] PotatoesFall@discuss.tchncs.de 9 points 3 months ago

People inexperienced with git can get stuck after doing some funky checkout / rebase stuff. If you don't know your way around git so well, I guess this is the obvious solution.

[-] SirQuackTheDuck@lemmy.world 5 points 3 months ago

I've been doing this yesterday. Not because Git broke, but since Intellij kept pulling invalid configs from the cache, and that was based on some kind of path identifier it seemed.

[-] Johanno@feddit.org 3 points 3 months ago

Gradle!

Fucking gradle. I do config stuff, rerun gradle error here, I fix the error rerun gradle: sth. Violation error.

Ok intellij invalidate chaches and restart.... Still same error.

Fine I'll do it again

git add. 
git commit -m "stuff"
git push

rm -rf repo
git clone repo
[-] iammike@programming.dev 4 points 3 months ago

You can probably use something like

git clean -xdf

To get rid of all the artifacts not tracked by git, in this case it's virtually the same as deleting the repo and re-cloning it.

NOTE: Make sure everyhing is staged, otherwise that data is gone

[-] andyortlieb@lemmy.sdf.org 13 points 3 months ago

I guess that's probably easier than learning how to wipe your ass.

[-] Prunebutt@slrpnk.net 13 points 3 months ago

I feel dumb: Why git rm -rf and not rm -rf? O.o

[-] JPDev@programming.dev 30 points 3 months ago* (last edited 3 months ago)

git rm -rf is only usable within the scope of the git repository and removes files in the staging area and working directory but doesnt affect untracked files or .git. rm -rf affects everything. For this case rm -rf probably would be the better option

edit: did a quick edit on the meme to change it to rm -rf since it makes more sense

[-] BatmanAoD@programming.dev 17 points 3 months ago

rm - rf is the only version that makes sense, since the only reason to delete and re-clone is to recover from an unexpected .git/ state, and git rm won't remove that.

[-] Prunebutt@slrpnk.net 3 points 3 months ago
[-] leisesprecher@feddit.org 1 points 3 months ago

Never heard of it, makes total sense, but I'd guess 95% of developers just nuke the directory raw.

[-] Prunebutt@slrpnk.net 3 points 3 months ago

That's the joke, yes.

[-] cupcakezealot@lemmy.blahaj.zone 10 points 3 months ago

ew french language pack gross

[-] RustyNova@lemmy.world 6 points 3 months ago

Delete container, rebuild container. Sometimes it's just useful to clean up all the mess of cache files

[-] bruhduh@lemmy.world 5 points 3 months ago
[-] sukhmel@programming.dev 11 points 3 months ago

No, not this time, at least

Four panel meme from the Simpsons, Marge screams "Cloudflare, no", Bart appears from the different direction with Cloudflare logo on him, asking why, Marge replies "Sorry, force of habit. CrowdStrike, no!"

this post was submitted on 23 Jul 2024
437 points (96.4% liked)

Programmer Humor

19551 readers
591 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 1 year ago
MODERATORS