Slashdot Mirror


Developer Accidentally Deletes Three-Month of Work With Visual Studio Code (bingj.com)

New submitter joshtops writes: A developer accidentally three-month of his work. In a post, he described his experience, "I had just downloaded VScode as an alternative and I was just playing with the source control option, seeing how it wanted to stage -- five thousand files -- I clicked discard... AND IT DELETED ALL MY FILES, ALL OF THEM, PERMANENTLY! How the f*uk is this s*it possible, who the hell is the d******* who made the option to permanently delete all the files on a project by accident even possible? Cannot even find them in the Recycle Bin!!!! I didn't even thought that was possible on Windows!!! F*ck this f*cking editor and f*ck whoever implemented this option. I wish you the worst.'

14 of 765 comments (clear)

  1. Git by irrational_design · · Score: 4, Informative

    Fortunately he can just retrieve his files from his Git repository, right? Or... he just learned a painful lesson of why you always use a code repository.

  2. Re:Version Control = Good by Aighearach · · Score: 5, Informative

    This isn't about backups, it is about not having a central repository. It isn't enough to have revision control, you have to actually be checking it in to a repository and sharing code. Even if you're only sharing with yourself, you still want your revision control to work well. And if you're not synchronizing anything, then you're not even getting feedback about if the system is working.

    It isn't enough to commit the code, you also have to push it somewhere. Even if that is just a repo on the same box.

    You don't want to restore this situation from backups, you want the restore to be from the repo. Much simpler and more to the point. And the backup would be of the repo, not the working directory!

  3. Re:Version Control = Good by djinn6 · · Score: 3, Informative

    You don't even need a central repo. For small projects I just zip the .git directory and upload it to Dropbox or Google drive once or twice a week.

  4. Was an accident waiting to happen by CraigCruden · · Score: 3, Informative

    It could have been just as easily a drive failure that deleted all the data. Instead, it was discarding the changes (and keeping the original version - which in this case amounted to nothing) [my guess not having familiarity with the tool]...

    I have lost a few hours of changes, but I it would be difficult to lose 3 months. You can use free services such as BitBucket for a single committer/project (private repository) as your offsite source control copy. You should also make a local backup and keep a regular offsite backup for important work that you cannot afford to lose. The fact that you get 3 months into a project then start thinking about source control is utter stupidity. It is a lesson this developer will hopefully learn (even if he has to learn it the hard way). On the bright side -- the second time I do something... it is always quicker...

  5. Bitbucket and 3 copies minimum by CraigCruden · · Score: 5, Informative

    A single copy on Dropbox that has no SLA with you... is not sufficient.

    You can setup a free account for a private repository on Bitbucket (free for small teams of ... one). (offsite cloud backup).

    You should also be doing regular local backups and rotating them at a friends house as well (3 copies minimum).

  6. Re:So, let me get this straight... by digital_fiz · · Score: 2, Informative

    It does mean discard pending changes which in his case happened to be everything or mostly everything? Both Git and VSCode are functioning properly he just clicked buttons without understanding what they did first. if he had copy/pasted a git checkout or git rebase code snippet he got on some website that wiped his stuff out and he was surprised this would have a different reaction but its no different. 2 major issues I see: - Not having backups of an obviously huge project either in git already or in a different location? - Why was he testing out an editor and clicking buttons he had no idea what they did on such a important project?

  7. Just tried it by Zalbik · · Score: 5, Informative

    So just for fun, I tried it.

    Did he happen to ignore the popup with the big yellow exclamation mark that says:
    "Are you sure you want to discard ALL changes? This is IRREVERSIBLE!"

    At the very least the ALL CAPS WITH EXCLAMATION MARK! should have possibly made him think "Hmmm...this seems to be a pretty important question"

    But apparently he decided: "Ah, screw it. It's only 3 months of my life".

    Given that level of skill, I can't think much of importance was lost.

  8. SVN by JBMcB · · Score: 3, Informative

    To be fair, I was using an old version of subversion, and issued a delete to a particular project branch I was working on. I deleted the project from that branch, and every other branch, along with every version. From everywhere. Not what I wanted. Not even what I asked. Turns out it was a bug triggered from upgrading the app on the specific platform I was on (I think it was Cygwin?)

    I had another machine with an old trunk that I recovered from, but still, crap like that happens even with source control.

    --
    My Other Computer Is A Data General Nova III.
    1. Re:SVN by F.Ultra · · Score: 3, Informative

      A delete in svn does delete the local files but the files are still there in the repository, a delete is basically a flag for the file there. If it where very old version of svn there might even been a local copy left in hidden .svn folders all over your project folder full with the old files.

  9. Re:Version Control = Good by Lord+Kano · · Score: 3, Informative

    You're probably right.

    Judging by the name, it would appear that this guy only graduated high school 2 years ago and recently graduated a free coding camp.

    LK

    --
    "Hi. This is my friend, Jack Shit, and you don't know him." - Lord Kano
  10. Re:Guy made a mistake by Nemyst · · Score: 4, Informative

    I'll agree that the language could be clearer, but it does show this popup when you try doing this right now. That should be a hint that something bad might happen, I'd say.

  11. Re:Git out of here, its great. by darkain · · Score: 4, Informative

    Totally this! I've been coding for some 20 years now or so. Even for small personal projects, they go into a managed repository. I lost about a week's worth of code in my youth, then I learned about Microsoft Visual SourceSafe, their local repository system. Then I transitioned that over to Source Offsite, a networked version of SourceSafe. This progression then moved through the ranks of CVS, SVN, and now to GIT. Having version control has so many benefits for even single devs, like diffing revision history. "How did I fuck myself up? Oh yeah, I can just check my commit history!" - This has saved my ass countless times.

  12. Re:Blaming the victim = bad by jtara · · Score: 4, Informative

    In Git, discard means "drop pending changes".M

    It was ALL PENDING CHANGES.

    He never did any commits!

  13. Re: Version Control = Good by Just+Some+Guy · · Score: 4, Informative
    That's not true:

    # Create an empty git repo.
    $ cd /tmp && git init --bare repo.git
    Initialized empty Git repository in /private/tmp/repo.git/

    # Clone it.
    $ git clone repo.git test_dir && cd test_dir
    Cloning into 'test_dir'...
    warning: You appear to have cloned an empty repository.
    done.

    # Create a file and add it to the repo.
    $ echo foo > foo && git add foo && git commit -m 'Added foo'
    [master (root-commit) 1813607] Added foo
    1 file changed, 1 insertion(+)
    create mode 100644 foo

    # Modify that file and add the change to the repo.
    $ echo foo2 >> foo && git add foo && git commit -m 'Modified foo'
    [master 6cb6f22] Modified foo
    1 file changed, 1 insertion(+)

    $ cat foo
    foo
    foo2

    # Push the change to the repo we made earlier.
    $ git push
    Counting objects: 6, done.
    Delta compression using up to 8 threads.
    Compressing objects: 100% (2/2), done.
    Writing objects: 100% (6/6), 421 bytes | 421.00 KiB/s, done.
    Total 6 (delta 0), reused 0 (delta 0)
    To /tmp/repo.git
    * [new branch] master -> master

    # Go back to the first version of foo. This simulates the case where
    # we pushed the first commit, then someone else added the second
    # commit.
    $ git reset --hard HEAD^1
    HEAD is now at 241f76f Added foo

    # Now change that file in a different way.
    $ echo foo3 >> foo

    # See? It's different from that second commit.
    $ cat foo
    foo
    foo3

    # Try to pull in that second commit that would overwrite the
    # uncommitted change we just made. Git has your back.
    $ git pull
    Updating 241f76f..3a175e4
    error: Your local changes to the following files would be overwritten by merge:
    foo
    Please commit your changes or stash them before you merge.
    Aborting

    --
    Dewey, what part of this looks like authorities should be involved?