top | item 15044264

Developer accidentally deletes 3 months of work with Visual Studio Code

51 points| jacobr | 8 years ago |cc.bingj.com | reply

72 comments

order
[+] danso|8 years ago|reply
The original Github issue seems to have been deleted, but here's a fresher cache that includes a response from a VS Code Microsoft employee, including a pic of what the warning dialog looks like: http://archive.is/EZX1O
[+] ziotom78|8 years ago|reply
Thanks, that answer actually adds some very important context!
[+] theknarf|8 years ago|reply
The sad part is that he didn't learn his lesson. The problem obviously isn't with Visual Studio Code, but with Git (or whatever version control software he tried out). It seems that he didn't know anything about using git and accidentally checked out a bare repo instead of adding his files to stage. From his post, he says he's using windows and he's used to things going into the recycle bin, something a Linux tool like Git obviously isn't going to do. So this is a mismatch between a beginner software developer on windows never having used Git before, and the mental model of Linux tools like Git.

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.

[+] sashagim|8 years ago|reply
You're blaming the victim. Yes, it's better to know git than not knowing it, but the developer was merely tossing around with the various options of the IDE. It shouldn't be that easy to make an operation with such disastrous results. It is the responsibility of the product designers to prevent this.
[+] sangupta|8 years ago|reply
The victim is not at fault.

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.

[+] mrighele|8 years ago|reply
I think that the first lesson that he should learn is the need for regular backups.

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.

[+] TheAceOfHearts|8 years ago|reply
This is one of the reasons I'm happy to have Time Machine on macOS. I've had times where I accidentally removed files due to a careless rm -rf in the terminal, as well as lost file changes due to mistakes with git. If you have local backups enabled, it's easy to recover reasonably recent files and changes. Admittedly, it hasn't happened to me in a fairly long time... But knowing you have some kind of safety net is reassuring.

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.

[+] emerongi|8 years ago|reply
The problem with warning messages is that people will often still just click through them. Someone WILL 100% still click through it and then complain. This is the problem with power tools. They can be very convenient and useful to users who know what they're doing, but harmful to users who are just clicking buttons.

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.

[+] sinxoveretothex|8 years ago|reply
I know nothing about Visual Studio Code and very little about anything VS in fact, so I have no idea how much is VS's fault and how much is the user's, but seriously, how on Earth is it possible to have 3 months of work not backed up or source controlled in any way?

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...

[+] ogrim|8 years ago|reply
I never trust anything but the commandline when it comes to git. Then I know full and well what I'm doing regardless of the editor. When there are too many icons and buttons to click I don't like to have to remember what they all mean, or how well they map to the underlying core git concepts.
[+] nailer|8 years ago|reply
I know what you mean, but for all its faults I like Sourcetree here: it doesn't use anything but what git does. You have a staging area, adding, interactive rebasing, everything uses gigs proper terminology. As opposed to the GitHub for Windows app for example which has new words.
[+] nallerooth|8 years ago|reply
+1 Graphical tools may help when presenting changes in a repo, but when it comes to making changes I too prefer the CLI.
[+] hungerstrike|8 years ago|reply
The commandline offers just as much opportunity to screw up your repository as a GUI does, if not more.
[+] Grue3|8 years ago|reply
This is a valid complaint. You simply don't design UI that allows to delete a large number of files with a press of a single button. That he didn't have backups is irrelevant. Even accidentally deleting fresh changes is quite damaging. VS Code doesn't say anything about Git, or what Git is. You can't expect anyone who downloads MS software to be a Git expert.
[+] nikki-9696|8 years ago|reply
It may be victim blaming, but having 3 months of work and it only exists on one hard drive on one computer isn't very bright. He learned the hard way. I mean honestly, disk drives fail. PCs break. The code should never be in only one place regardless. Also, coming from VSS to Git has been, and still is, one of the hardest things I do as a windows dev. I hate git. It is non-intuitive and I have accidentally deleted my work before also, the difference being that I have it stored else where to get it too.
[+] NicoJuicy|8 years ago|reply
So, his hard drive could die. He could have a virus or a crypto infection. All would delete his work.

A developer uses source control, it's as easy as that.

[+] Boothroid|8 years ago|reply
Quite apart from the problem of total code loss there's the lack of a safe way to prototype changes - how the hell does he revert in a situation where he inadvertantly breaks his previously working code?!

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.

[+] Vanit|8 years ago|reply
A developer agrees.
[+] xeo84|8 years ago|reply
No source control, no backups and you "play" with a new software to see how it handles 5000 files? Well... not sure what to say here..
[+] chrisbennet|8 years ago|reply
As a product developer, when a user of my software "makes a mistake" my first response is to ask myself "What could I have done to avoid the user making this mistake?"

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...

[+] tym0|8 years ago|reply
He says that it wasn't in a repo, so it's a bit weird that it would delete all his files, it looks more like he had an initialised repo and hadn't committed the files yet.

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.

[+] lopespm|8 years ago|reply
Exactly, a good portion of deleted files could probably be salavaged using "Recuva" right away, for example
[+] Boothroid|8 years ago|reply
Exactly, all the deletion does is remove the file system connection to the location of the data on disk. Someone needs to get in touch with this guy and tell him to stop using that drive!
[+] antigirl|8 years ago|reply
He deleted his profile, rightly so - thats no way to act on github, open forum for pretty much every web developer out there. Not making a good name for yourself
[+] arnioxux|8 years ago|reply
I predict one day we will look back and be horrified that there was ever a time where you can't just roll back an entire system to an arbitrary timestamp to undo accidental changes.

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.

[+] reustle|8 years ago|reply
I don't use it, but isn't that what Time Machine on MacOS does?
[+] lonnie_jones|8 years ago|reply
His story is a little funny and a little sad. I had a similar experience but I was much more cautious. I had actually backed up my project through GitHub desktop and committed it before formatting my computer. After cleaning and setting the system back up, I lost a days worth of work. I was 100% sure I had committed it. When I started back where I was and committed my changes, I checked the web Github to ensure that the changes were still submitted and they weren't. There was a bug with Windows 10 and Github that caused it. After that I decided to use Google Drive to backup my Github upon changes. Don't try to use Github folders and Google Drive folders as the same directories. Something weird happens and only one will work. Now I make submissions to Github and have a duplicate folder (using relative paths in my project) in my Google drive. Alternatively, you can submit your changes through the Github website, but it takes forever.
[+] gjvc|8 years ago|reply
I learned about "git checkout ." the hard way once, too. Only lost three hours then, though.
[+] blueprint|8 years ago|reply
But, for real, 3 months of work and not a single backup?
[+] WeedRamen|8 years ago|reply
Really feel for the guy. Hasn't happened to me, but I would hope a developer friendly editor would give warnings about when something like this could happen. Does VS Code have a tutorial? Haven't used it before, can't say I am inclined to right now...
[+] bigkm|8 years ago|reply
My response to this person would be:

well you're going to have to restore from backup.

Oh you don't have a backup? Why not? (Some excuse) LOLZ

[+] stillsut|8 years ago|reply
"This is Git. It tracks collaborative work on projects through a beautiful distributed graph theory tree model.

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."

- https://xkcd.com/1597/

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.

[+] eklavya|8 years ago|reply
I have seen people learn to source control the hard way multiple times, but usually they were saved (at least partially) by the local history feature in IDEs. This guy was hit very hard, I feel sorry for him.