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

Programmer Humor

19638 readers
1920 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
638
submitted 15 hours ago* (last edited 15 hours ago) by [email protected] to c/programmer_humor
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 11 points 4 hours 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.

[–] [email protected] 2 points 1 hour ago (1 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.

[–] [email protected] 1 points 1 hour 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

[–] [email protected] 2 points 4 hours ago