this post was submitted on 20 Nov 2024
669 points (97.3% liked)

Programmer Humor

19623 readers
2078 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
669
submitted 18 hours ago* (last edited 17 hours ago) by [email protected] to c/[email protected]
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 6 points 17 hours ago (18 children)

Hm ok yeah, that seems quite scary sounding so that i would strongly hesitate before clicking on "discard ALL changes". Still, I wonder if a second confirmation dialog with more information is warranted for a command that's so destructive.

[–] conciselyverbose 57 points 17 hours ago (16 children)

I wouldn't assume "discard changes" means "delete files that existed before the editor did".

[–] [email protected] 9 points 16 hours ago (10 children)

It's changes from the prior commit in the repository, which, if they had not committed anything prior, would have been an empty directory.

This is perhaps a good lesson in teaching version control as its own concept rather than "streamlining it" by bundling it with an editor.

[–] conciselyverbose 17 points 16 hours ago (1 children)

You shouldn't be taking ownership of files and then deleting them without communication a hell of a lot better than that.

I understand what happened. I'm saying that if you're going to delete stuff that was there before the software was, your flow to adding a project should include suggesting a base level commit of everything that's there already.

[–] [email protected] 5 points 14 hours ago (1 children)

That's definitely fair, creating a repository in a non-empty directory could definitely suggest auto-committing the current state if it doesn't already. I don't use VSCode so I wouldn't know.

Although now that I think about it, that could have been the intention here but not automatic, if that's why 5k+ files were staged without the user explicitly staging them. Extra tragic if that's the case.

[–] [email protected] 1 points 9 hours ago (1 children)

Although now that I think about it, that could have been the intention here but not automatic, if that's why 5k+ files were staged without the user explicitly staging them. Extra tragic if that's the case.

From the git discussions around the issue, it wasn't that the files were automatically staged, but that the "discard all changes" feature invoked a git clean, and also deleted untracked files.

Since OP's project wasn't tracked, it got detonated.

[–] WolfLink 1 points 4 hours ago

Since OP's project wasn't tracked, it got detonated.

This is the biggest part of the problem. Using git directly, it just ignores files that aren’t tracked.

load more comments (8 replies)
load more comments (13 replies)
load more comments (14 replies)