Developer accidentally deletes 3 months of work with Visual Studio Code
cc.bingj.com
cc.bingj.com
Personally I think this little detail changes the whole situation. And that's not even taking into account the idiocy of not having a backup and not incrementally adding the project to some form of version control.
Hell, even for all but the simplest TOY project I create a git repository and push it to gitlab!
> Are you sure you wish to discard ALL changes? This is IRREVERSIBLE!
Yes, very scary, like many warnings that some systems teach us to ignore.
It doesn't say what "changes" will be discarded. Are those the changes it made since the IDE was installed? Did the IDE make changes? Some kind of project files or directories? Some kind of setup? Is a novice supposed to know this?
Even on the home-grown IDE I use at work, it saves backups in a trash area when you delete files in case you accidentally delete something you don't intend to. (Actually, I got very concerned once thinking I had deleted something I hadn't committed yet... as I recall it was a false alarm, but I was pleased that my concern was misplaced.)
And given that a lot of other people have experienced this, I'd say there is evidence that this is a UX (User eXperience) problem, not necessarily a PEBCAK (Problem Exists Between Chair and Keyboard):
https://social.msdn.microsoft.com/Forums/expression/en-US/b3...
I agree with him that Visual Studio Code could probably have designed their warning message a bit better, for people like him who have no experience with Git.
And now to the sad part, having accidentally deleted all his files while trying out Git; he will probably never touch Git again! So instead of learning the lesson he should have learned; always use version control on everything, what he did learn was; Git is harmful, don't use it.
Of course it also kinda seems like he blames VS Code and doesn't understand that it was the fault of Git, but that won't make him start using Git anytime soon.
Learning about version control, especially Git, is the most important thing a software developer can learn as early as possible in his career.
When people empty their recycle bin they kind of understand what is going to happen. Discarding changes speaks to me but evidently not to this person. Personally I tend to put my code in Dropbox in early stages as git commits do not make much sense (of course one can squash everything and do a rebase but that is advanced git already).
At some point you have to take responsibility for knowing your tools. This is a professional.
He might know how to write code, but obliviousness towards source control (and backups, for that matter) is a HUGE indicator of him not being a professional.
Anyone who has anything important on a computer should know to back it up somewhere.
The victim did it to themselves, it's like playing with a loaded gun then complaining when you accidentally shoot yourself in the face. A bad workman always blames their tools. At the very least they should have learnt Git.
Well not that hard, because of course I tried it first on a copy of the project so haven't lost anything (if not time).
But even if I agree that what is going to happen is unclear for some (included me at the time), and a total wipe of your work is excruciating, you don't "try things" on the only copy of 3 months of work.
A three month project without backup or version control shows a lack of basic training.
I wish schools and universities would teach version control on day one of CS courses.
Even most of my relatively computer-illiterate friends and family members do rudimentary backup for their stuff (usually in the form of emailing themselves or just creating a copy).
Then you have the option of just saying "you're an idiot" or developing a safety net around the feature so the action can be undone.
In fact, I am not even sure he meant to use git ("I hadn't commited any of them to any repository"). If it that's the case, I would understand why he did such a mistake:
* Open the folder in VS Code
* Explore around, discover the Git tab on the left, "This workspace isn't yet under git source control", press the button
* "Whops, I didn't want to do this", check around and see that there is a button to "clean the changes"
* Destroy 5000 files by mistake.
In any case, I don't understand why developer oriented tools rarely take into account the fact that developers too make mistakes, and they should have the ability to undo them. This is especially true with Git, where the UI is in my opinion particularly convoluted and error prone.
1. On Windows, the standard mechanism to delete files it to move/ to 'Recycle Bin' - why did the IDE override the functionality?
2. In git, this action is equivalent to 'git checkout' that will show you a message to stash. In earlier versions of git, where message to git stash are not shown, the files are not deleted from disk.
The problem highlighted here is a genuine one, the IDE MUST and MUST show warning before such destructive operations.
VSCode has second confirm and warning you: "This is IRREVERSIBLE!"
Would that not be a better info/warning message to a user?
And if many IDEs delete files permanently, why can't VSCode start to do what's the right thing - move it to Trash/Recycle Bin.
Many startups (like Slack) didn't copy what all did, they did the right thing.
It is the standard mechanism when you are working with Windows Explorer (explorer.exe). However, if you try doing it via any API, it is far from trivial. All of the standard file delete operations in all platforms that I have worked with delete the files straight away. From developer's point of view, Recycle Bin is just a Windows Explorer's concept and not something that other applications should know how to work with.
A lot of our tooling and operating systems were designed for a different time, and their age is really starting to show in cases like these. Fault tolerance is incredibly important, and it has taken a backseat position for far too long.
I once had a nasty file system corruption due to disconnecting the power cord that corrupted my (local) git repo and almost made me lose a day of work. Even with source control there are risks.
If there is anything positive to take away from this,it should be to learn to consider risk management.
If you write code even, say, once every week and haven't yet bothered to learn how to use source control, you owe it to your mental sanity to do it now.
EDIT: archived http://web.archive.org/web/20170818080940/http://cc.bingj.co...
> git-clean - Remove untracked files from the working tree
https://git-scm.com/docs/git-clean
Now I would call that description very precise and readable.
Here's the GUI's warning:
> Are you sure you wish to discard ALL changes? This is IRREVERSIBLE!
What changes? He didn't change anything. Did the GUI change something? Maybe it did. Maybe nothing will happen.
Foolish not to back-up before experimenting? Sure. But GUI's imply friendliness to the inexperienced. This seems like bad UX.
See joaomoreno's comment on that page.
A developer uses source control, it's as easy as that.
If this guy did any kind of decent IT or programming course you would think they would have covered at least backing up at some point. If he has done a course and still ended up in this situation I'm tempted to say it's time for him to find a new career.
As Jeff Attwood says:
"a well-designed system makes it easy to do the right things and annoying (but not impossible) to do the wrong things."
https://blog.codinghorror.com/falling-into-the-pit-of-succes...
I don't even know how you could work 3 months without committing, even working on a throwaway thing for more than a few hours I make a new local repo, it doesn't cost much.
Also the files are not gone, they are still on the hard-drive/SSD it's not that hard to look up file recovery software.
It seems to have happened to rather a lot of people https://social.msdn.microsoft.com/Forums/expression/en-US/b3...
In some sense this is already achievable if you just always work inside a Dropbox folder (which keeps a 30 day history of any synced changes). But resources aren't yet cheap enough for all changes to be immutable.
Thinking of what it would be like to go back to a world without similar functionality makes me shudder.
well you're going to have to restore from backup.
Oh you don't have a backup? Why not? (Some excuse) LOLZ
Cool. How do we use it?
No idea. Just memorize these shell commands and type them to sync up. If you get errors, save your work elsewhere, delete the project, and download a fresh copy."
I think MS would do well to just buy this comic from Randall Munroe and display it on git init. In 10 seconds you get a more useful and realistic appraisal of the tool than you will from reading the docs for an hour. You heard me right: Docs by Meme.
Source control responsibly people! :)
You could argue it was my fault because I didn't stage and commit the new file, but there's no reason to close a buffer just because the backing file is gone. Close it if I say so, otherwise keep it open with the last-seen contents of the file. This has always worked fine in Sublime.
Please always err on the side of not losing data, even if it means keeping around "annoying" extra tabs.