let’s turn this into a constructive angle for future devs and current juniors: just learn git cli, I promise you it is much simpler than it seems.
all those memes about git having like a thousand commands are true, but you really will only use like 7 at most per month.
learn push, pull, merge, squash, stash, reset, im probably missing like one or two
I promise you again: it is much simpler than it seems. and you won’t have to use these stupid git GUI things, and it will save you a hassle because you will know what commands you are running and what they do
short disclaimer: using git GUI is totally fine but low-key you are missing out on so much
I fucking HATE when abstractions over git use cutesy names that git doesn’t use.
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.
Honestly no idea why editors give shit random names instead of using the terms git uses.
Poor guy basically did a git reset —hard HEAD without even a git repository
I feel bad for this kid. That really is a bad warning dialog. Nowhere does it say it’s going to delete files. Anyone who thinks that’s good design needs a break.
Half the replies are basically “This should be obvious if your past five years of life experience is similar to mine, and if it isn’t then get fucked.” Just adding insult to injury.
I’m not great at English, but “discard all changes” shouldn’t ever mean “Delete”.
In the context of version control it does. Discarding a change that creates a file means deleting the file.
Jesus saves, and so should you
If you ever happen to have 5000 uncommitted files, you shouldn’t be asking yourself if you should commit more often. You should be asking yourself how many new repos you should be making.
The person didn’t have any git repository; probably a new programmer that didn’t know how version control works and just clicked discard without understanding what that means in this situation.
This is without gitignore, so probably just installed one js dependency
Looks like someone forgot about the 3-2-1 rule. Teachable moment.
Go on…
3 backups: 2 different places/media on-site 1 off-site
What about 2 offsite and 1 onsite? That’s been my approach, mostly due to storage limitations onsite.
technically isn’t a vcs supposed to be one of those different places?
Yes, but the OP went 3 months without it and then messed up during setup
Maybe he would prefer perforce.
deleted a chunk of my work the other day by pressing Ctrl z in windows explorer. my project was without source control installed (cuz it was in Dev stage), and Ctrl shit z/Ctrl y hotkeys didn’t work, so that chunk was just gone, persished forever… or so I though. I remembered vs code having a file history under some panel. found it, and here it was - at least some of the latest history of my file. lesson learned: even in Dev where nothing is yet working, finish your day of coding with a commit to a remote repo.
all I’m learning from these stories is to stay far far away from vscode.
I begrudgingly switched to vscode a few years ago. I’ve never had any issues like this with it. My only issues have been with a plugin that I installed optionally (and that was later fixed by the plugin author).
Nah you gotta submit a bug report for that
The real issue is already going 3 months without source control.
The person didn’t have any git repository; probably a new programmer that didn’t know how version control works and just clicked discard without understanding what that means in this situation
I have heard things from another apprentice who just does not use version control at all and the only copies are on his laptop and on his desktop. He is also using node.js with only 1 class and doesn’t know about OOP (not sure if you even use that in js no clue 😅) and has one big file with 20k lines of code I have absolutely no clue how he navigates through it
Ey! Reminds me of my middle-school years! I still can’t belive I made an entire game without a single class… Just storing info in arrays and writing in comments what location represents what data. But I was a literal child, too young to read guides or sit through “long” tutorials.
I don’t want to sound too mean, but whenever I see anything similar at work, I wish that person get a job they’re actually good at. It’s fine and all that the company started hiring actual programmers to fix things, but the fact that the old crew still fucks shit up with senior privileges is a major grievance.
Those are rookie numbers. I have at least a 35k one somewhere. More than one actually.
People run their businesses on this.
I know the type. Usually the kind of confident know-it-all who refuses to learn anything but delivers changes really quickly so management loves them. I had the misfortune to fix such a project after that ‘rock-star’ programmer left the company. Unfortunately the lack of professional standards in our industry allows people like that to continuously fail upwards. When I left the project they rehired them and let them design the v2 of the project we just fixed.
Jesus, reminds me of a similar story. My gf once lost a job to someone who literally just pasted code into LLMs, also delivering quickly, even tho it was hot garbage. Anyhow, she spent a lot of her time fixing his shit and so her output went down. I hope that company burns to the ground with completely un manageable software.
When I left the project they rehired them and let them design the v2 of the project we just fixed.
Lol. Wow.
And that is why I’ve been unable to work myself out of a job in all my long years as a developer.
My company for the longest time had two engineers they would give all the new projects to. They would rush through some prototype code as fast as they could then management would bring in a new team to take the project over. The code was always garbage and crammed into one place. I kept getting new projects and instead of starting from a nice clean slate we always had to build on that garbage. It sucked so bad.
He just heard monoliths were in again
Reading this just give me a panic attack
Typical web developer. He didn’t even know files can be deleted without going into „recycle bin”
Why are we dissing web developers? What is this bullshit elitism?
I think it’s a joke about how noobs only learn javascript and make blazing fast webapps while knowing nothing about computers.
The reactions here are why people don’t join forums, don’t ask questions, or choose to learn alone. “duh, I knew that”. Yes, the dude didn’t, which is exactly why he’s frustrated. I think too many have forgotten what it’s like to be a beginner and make a fatal mistake, which would explain the mocking responses here and things like recommending new linux users Arch.
There is a difference between someone who is new and experiences something like their IDE deletes a file that was unexpected and asking a question about why it did that.
Then there are arrogant assholes who believe their shit doesn’t stink and that they couldn’t have done anything wrong and it was the IDE’s fault for not knowing what they wanted to do versus what they commanded it to do.
The OP is the latter.
I mean, not entirely, and he says he lost months worth of work. Like imagine you know nothing of git:
-
Click buttons in the IDE to add source control.
-
IDE says a bunch of files have been changed.
-
But I don’t want to make changes to the files, I want to source control them.
-
Attempt to undo the changes. Click “discard changes” thinking it will put them back to how they were before clicking add source control. Get a warning dialog that this is not undoable, but that’s fine because I don’t want whatever changes it made to my files anyway.
-
All files are deleted and unrecoverable.
Like that experience sucks balls and it’s reasonable that a person wouldn’t expect “discard” == “delete”. Also, from reading the GitHub thread, apparently at that time VSCode was doing a
git clean
when you clicked this. Which like…yeah why the hell would it do that lol? I don’t think I have ever usedgit clean
in my entire career.-
In case anyone else is wondering, or simply doesn’t like reading screen shots of text, this is apparently a real report:
Steps to Reproduce:
1.Go near this fucking shit editor.
2.Commit the deadly sin of touching the source control options.
🤣
- Ignore the scary warning VS Code shows you when you press the button.
4. Complain about lack of a scary warning.
I dunno, “discard changes” is usually not the same as “delete all 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.
What exactly do you think discard means?
“Changes” are not the same thing as “files”.
I’d expect that files that are not in version control would not be touched.
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.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.
Yeah. They did substantially modify the message to make it much clearer, thankfully.
It means both.
“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”.
If the change is a new untracked file
Wasn’t the issue that it deleted a bunch of preexisting untracked files? So old untracked files.
And the terminology is misleading, resulting in problems. shrug.
Having done exactly 0 research, I going to assume it’s one of those “DO NOT PRESS OKAY UNLESS YOU ARE EXPERIENCED AND KNOW WHAT YOU ARE DOING” and someone went “pffft I know what I’m doing. click now what does this option do…”
Pretty sure the scary warnings in big bold text are more recent than this report.
Nope. The scary warning is even screenshotted and used as an example in the post report discussion.
It’s quite the fun read!
The dude ranted for awhile in the issue thread and closed the issue himself too! lol
This link was included in the post but I realize that “source” was probably not the best label for it. Updated to make it more clear.
In reality, VSCode has local file history called “Timeline”. It’s enabled by default.
https://github.com/microsoft/vscode-docs/blob/vnext/release-notes/v1_66.md#local-history
In reality, that was added four and a half years after this issue was opened.
Oh, didn’t notice this was a 7 year old issue.
Understandable; no time to check details when your fuse is that short