“Changes” are not the same thing as “files”.
I’d expect that files that are not in version control would not be touched.
Apparently, it means changes to the directory structure and what files are in them, not changes within the files themselves. It really ought to be more clear about this.
“Changes” encompass more than you think. Creating / Deleting files are also changes, not just edits to a file.
- If the change is an edit to a tracked file, “Discard Changes” will reverse the edit.
- If the change is deleting a tracked file, “Discard Changes” will restore it back.
- If the change is a new untracked file, “Discard Changes” will remove it as intended.
It can also be all of them at the same time, which is why VSCode uses “Changes” instead of “Files”.
Yeah. That’s discussed in more detail in the code change that resulted from the issue report.
It’s a ballsy move by the VSCode team to not only include git clean
but to keep it after numerous issue reports.
As others discussed in that thread, git clean
has no business being offered in a graphical menu where a git novice may find it.
That said, I do think the expanded warning mesage they added addresses the issue by calling out that whatever git
may think, the user is about to lose some files.
Nowadays the warning even says that this cannot be undone. Maybe that wasn’t present in 1.15, though.
It was. If you go through the OP thread, one of the responses is a picture of the dialog window that this user clicked through saying, “these changes will be IRREVERSIBLE”.
The OP was just playing with a new kind of fire (VSCodes Git/source control panel) that they didn’t understand, and they got burned.
We all gotta get burnt at least once, but it normally turns us into better devs in the end. I would bet money that this person uses source control now, as long as they are still coding.
If the “changes” are all your files, discarding them for me means basically delete my files, you know, the ones you are trying to add.
At the same time, OP seems a layman, and might be coming from things like Microsoft Word, where “Discard all changes” basically means “revert to last save”.
EDIT: After reading the related issues, OP may have also thought that “discard changes” was to uninitialise the repository, as opposed to wiping untracked files.