this post was submitted on 20 Nov 2024
861 points (97.5% liked)

Programmer Humor

19817 readers
71 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
you are viewing a single comment's thread
view the rest of the comments
[–] LANIK2000@lemmy.world 32 points 1 month ago (3 children)

Honestly no idea why someone would go around a completely unknown menu in a new unknown editor and randomly click things with caution completely out the window. Not having a copy or trying a blank project, not even reading any messages. I mean even if we don't know it's a nuke button, God knows what other edits it could do to your code without you knowing.

This goes beyond rookie mistake. This is something 12 year old me would do. Same with the issue page being 90% swear words.

[–] calcopiritus@lemmy.world 20 points 1 month ago (3 children)

I don't even know why people ITT are blaming the IDE and completely ignoring this.

When you learn git, you do so on a dummy project, that has 5 files which are 10 characters long each.

An IDE is not made so you can't break things, it is tool, and it should let you do things. It's like complaining that Linux will let you delete your desktop environment. Some people actually want to delete your desktop environment. You can't remove that option just because someone can accidentally do it by ignoring all the warnings.

[–] thebestaquaman@lemmy.world 15 points 1 month ago (2 children)

Got will not delete untracked files though, which is what happened here. If you want to discard changes to a file with git, you first have to commit the file to the index at some point, which means there's only ever so much damage an erroneous "git restore" or "git reset" can do. Specifically, neither of them will delete all the files in an existing project where VC has just been added.

[–] calcopiritus@lemmy.world 7 points 1 month ago (2 children)

This user was not using git though, he was using vs code. That button doesn't say "git reset" it says "discard all changes". And btw, what it does is "git clean", which is something that git can do.

Just below the button there is a list of all the changes. In his case, there were 3000 changes of the type "file creation". Discarding a file creation can only be made one way: deleting the file.

Anyway, this user is presumably in his learning phase, I would not assume that he knows what git reset or git restore actually do.

[–] Hawk@lemmy.dbzer0.com 4 points 1 month ago

In other IDEs this discards tracked changes, untracked files usually stay untouched.

In my opinion, it's a combination of user error and bad implementation here

[–] thebestaquaman@lemmy.world 1 points 1 month ago

Fair enough, git clean does exist. However, if the button saying "discard all changes" is really a button that runs git clean, that's just a plain terrible design choice. git clean is "delete all untracked files", which is specifically not discarding changes, because there can be no changes to discard on an untracked file. Even talking about "changes" to an untracked file in VC context makes little sense, because the VC system doesn't know anything about any changes to the file, only whether it exists or not.

That's not even mentioning the fact that the option to "git clean" shows up as one of the easily accessible options in relation to a staging process. Especially if you're coming from the git CLI, you're likely to associate "discard changes" with "git restore".

[–] Valmond@lemmy.world 1 points 1 month ago (1 children)
[–] thebestaquaman@lemmy.world 2 points 1 month ago

Yeah, I guess I've got to leave it like that now..

[–] Cethin@lemmy.zip 4 points 1 month ago (2 children)

They could have a warning though. I agree with you, but there are some easy ways to prevent this from happening. It just takes time to implement, and would be required in other places too. Is it worth the dev time? I doubt it.

[–] calcopiritus@lemmy.world 5 points 1 month ago

There is a warning. IIRC it says "are you sure you want to discard all changes? This action is unreverisble". In the context of version management. Creating a file is a change. And just below the button to discard all changes is the list of changes. In that list he could've seen 3000 changes of the type "file creation", when you discard a file creation, it means to undo the creation, which is a deletion.

The button days what is going to do. There is a warning about what it's going to do. And there is a list of the exact changes it's going to undo.

The only way to avoid this from happening is to not have the button exist. In that case, the users that actually want to discard all changes would be unable to do so.

[–] JackbyDev@programming.dev 2 points 1 month ago

Right? "You are about to permanently delete 5,345 files, they will not be sent to the recycling bin, are you sure?"

[–] MajorasMaskForever@lemmy.world 4 points 1 month ago

Linus Sebastian enters the chat

[–] JackbyDev@programming.dev 17 points 1 month ago (1 children)

Honestly no idea why editors give shit random names instead of using the terms git uses.

[–] LANIK2000@lemmy.world 3 points 1 month ago

I find it amazing, how every time I see a git GUI I'm completely lost and that it's always completely different, considering it's the same app underneath and that app doesn't have THAT many different functions.

[–] Cethin@lemmy.zip 14 points 1 month ago (1 children)

This is a disease of GUIs. Most people are so used to having their hands held and being unable to make a mistake that when a GUI actually gives you the power to fuck up they don't expect it. I promise you, if this user was using the CLI, this wouldn't have happened as easily.

[–] Kbobabob@lemmy.world 7 points 1 month ago (1 children)

I promise you, if this user ~~was using the CLI~~ backed up their files, this wouldn't have happened ~~as easily~~.

[–] Cethin@lemmy.zip 4 points 1 month ago (1 children)

That too, but it seems like this was them attempting to back up their files. They just critically failed.

[–] Kbobabob@lemmy.world 2 points 1 month ago* (last edited 1 month ago)

Using a program that's not designed to be a backup solution that you are also unfamiliar with sounds even worse. Lol