
Developer accidentally deletes 3 months of work with Visual Studio Code - jacobr
http://cc.bingj.com/cache.aspx?d=1462716999241&mkt=de-DE&setlang=en-US&w=xEsMxqoa0KJSwMsTh3p_8w2qryykfDvB
======
danso
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](http://archive.is/EZX1O)

~~~
ziotom78
Thanks, that answer actually adds some very important context!

~~~
mercer
Yeah, I actually got this dialog once and immediately clicked on 'cancel' to
make sure I understood what the command did.

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!

~~~
aaronchall
This didn't happen to me and I'd like to think I'm being objective here - the
dialog says:

> 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...](https://social.msdn.microsoft.com/Forums/expression/en-
US/b32e47a9-d86c-473a-9449-a7f5c202463c/visual-studio-code-just-deleted-all-
my-files?forum=visualstudiogeneral)

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

~~~
yoz-y
I think the question is more likely: should an operation like this be possible
at all? VSCode already gives you a big warning (as shown in the issue) that
"discarding changes" is irreversible but it does not explain what "discarding
changes" means.

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

~~~
nailer
There's a bug out for not deleting files that haven't been added to the
repository when discarding changes:

[https://archive.is/GisMJ](https://archive.is/GisMJ)

------
sinxoveretothex
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...](http://web.archive.org/web/20170818080940/http://cc.bingj.com/cache.aspx?d=1462716999241&mkt=de-
DE&setlang=en-US&w=xEsMxqoa0KJSwMsTh3p_8w2qryykfDvB)

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

~~~
hungerstrike
The commandline offers just as much opportunity to screw up your repository as
a GUI does, if not more.

~~~
aaronchall
Here's the description for the man-page for git-clean:

> git-clean - Remove untracked files from the working tree

[https://git-scm.com/docs/git-clean](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.

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

~~~
memer
But it wasn't a single button, there was a warning message:
[https://archive.fo/EZX1O](https://archive.fo/EZX1O)

See joaomoreno's comment on that page.

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

------
xeo84
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
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...](https://blog.codinghorror.com/falling-into-the-pit-of-success/)

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

~~~
mjw1007
This post shows the likely sequence of actions that makes it happen:
[https://stackoverflow.com/a/33235641](https://stackoverflow.com/a/33235641)

It seems to have happened to rather a lot of people
[https://social.msdn.microsoft.com/Forums/expression/en-
US/b3...](https://social.msdn.microsoft.com/Forums/expression/en-
US/b32e47a9-d86c-473a-9449-a7f5c202463c/)

------
antigirl
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
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
I don't use it, but isn't that what Time Machine on MacOS does?

~~~
slindz
It has been trivially easy to restore files and folders in situations like
this with TimeMachine for a very long time.

Thinking of what it would be like to go back to a world without similar
functionality makes me shudder.

------
lonnie_jones
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
I learned about "git checkout ." the hard way once, too. Only lost three hours
then, though.

------
blueprint
But, for real, 3 months of work and not a single backup?

------
WeedRamen
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
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
"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/](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
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.

------
styfle
This got "fixed" in #32459

[https://github.com/Microsoft/vscode/issues/32459](https://github.com/Microsoft/vscode/issues/32459)

------
mastef
Pro-tip : you can keep your little projects in a Dropbox folder. Will keep
track of your file changes automatically and can help restore deleted files /
or restore them to earlier versions.

------
dovdovdov
Haha, SourceTree can also do that! Fun times!

Source control responsibly people! :)

~~~
yoz-y
Windows explorer too, just shift+delete the stuff. Microsoft should probably
just make a snapshot-capable filesystem and do complete snapshots every hour
or so.

------
devrandomguy
Streisand effect is taking off:
[https://github.com/Microsoft/vscode/issues/32795](https://github.com/Microsoft/vscode/issues/32795)

------
mcheung610
This is like someone is trying to learn how to cook the first time and burned
the house down. Instead of blaming himself, he blame the stove and fire.

------
whipoodle
Well, that's not very positive... but I can relate. VS Code lost some work of
mine on the first day I tried it, so I decided not to continue using it. It
wasn't super important so I wasn't angry, but it was a good chunk of code I
had just spent probably 45 minutes writing and debugging.

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.

~~~
devrandomguy
Excessive automation considered harmful: even if you want something to happen
99% of the time, it should still be a manual operation. Otherwise, it will
bite 100 of your 10,000 users at least once.

~~~
whipoodle
If it's a destructive operation, yeah. I was really, genuinely surprised that
their editor works like that. As you say, it's not something that will bite
you often, but when it bites, it could be pretty painful.

------
Quarrelsome
its always sad to see people learn the lesson of source control the hard way.

~~~
bigkm
This is more of a backup lesson.

~~~
devrandomguy
I would call it a UX design lesson, primarily, although all undesirable
changes are also backup lessons.

