You are viewing a single thread.
View all comments View context
72 points

I’m not great at English, but “discard all changes” shouldn’t ever mean “Delete”.

permalink
report
parent
reply
30 points

In the context of version control it does. Discarding a change that creates a file means deleting the file.

permalink
report
parent
reply
3 points

“Discard” is not a git operation.

permalink
report
parent
reply
14 points

If you have set up your staging area for a commit you may want to discard (unstage) changes from the staging area, as opposed to discarding changes in the working directory.

Of course, the difference between the two is obvious if you’re using git CLI, but I can easily see someone using a GUI (and that maybe isn’t too familiar with git) misunderstanding “discard” as “unstage”.

Either way, what happened here indicates that all the files were somehow added to the VC, without having been committed first, or something like that, because git will not let you discard a file that is untracked, because that wouldn’t make any sense. The fact that the GUI let this person delete a bunch of files without first committing them to the index is what makes this a terrible design choice, and also what makes the use of the word “discard” misleading.

permalink
report
parent
reply
3 points

Ok fair enough, but I’m under the impression these files existed before the source control was implemented.

I guess it’s all up to how the program handles existing files.

permalink
report
parent
reply
4 points

I guess the newly created git repository was empty, and all the files that was present in the folder represented “changes”

permalink
report
parent
reply
5 points

I’m pretty sure vscode shows a confirmation dialog when discarding changes will permanently delete a file. I’ve done that recently with temporary files that were no longer needed.

permalink
report
parent
reply
2 points

Did you even read the thread?

permalink
report
parent
reply
10 points

I remember following the drama back in the day. That warning you saw was the result of this now-classic bug report.

permalink
report
parent
reply
3 points

the alternative to deleting is emptying the file contents, which is essentially the same…

permalink
report
parent
reply

Programmer Humor

!programmer_humor@programming.dev

Create post

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

  • Keep content in english
  • No advertisements
  • Posts must be related to programming or programmer topics

Community stats

  • 5.3K

    Monthly active users

  • 1K

    Posts

  • 38K

    Comments