• Semi-Hemi-Lemmygod@lemmy.world
      link
      fedilink
      English
      arrow-up
      0
      ·
      21 hours ago

      That’s not a very good dialog box. He didn’t make any changes, so discarding them doesn’t sound like a problem.

      There should be a notice when you enable source control that this will permanently delete all existing files with a checkbox (checked by default) that says “Add existing files to source control.”

      • Pyro@programming.dev
        link
        fedilink
        arrow-up
        0
        ·
        20 hours ago

        He wouldn’t have seen the “Discard Changes” button at all if source control wasn’t already setup (and detected by VSCode).

        No program will delete files either when you initialize source control.

        • LordPassionFruit@lemm.ee
          link
          fedilink
          arrow-up
          0
          ·
          19 hours ago

          My sibling ran into this issue once. I’m not sure if it’s a setting or a default, but vscode would assume they were working in a blank repo until they made a commit.

          Sounds like this person had the project (without source control) in another IDE, tried out VSCode, and it assumed that it was all ‘changes’. I don’t use VSCode, do I can’t say for certain, but I know my sibling lost ~4 hours of project set up for the same reason (though they immediately realized it was their fault).

          • Pyro@programming.dev
            link
            fedilink
            arrow-up
            0
            ·
            19 hours ago

            Reading your comment and #32459, I realize that VSCode source control did have some major issues back then.

            It looks like they have improved though, as the latest VSCode I use doesn’t auto-initialize repositories anymore.

    • Beacon@fedia.io
      link
      fedilink
      arrow-up
      0
      ·
      21 hours ago

      Hm ok yeah, that seems quite scary sounding so that i would strongly hesitate before clicking on “discard ALL changes”. Still, I wonder if a second confirmation dialog with more information is warranted for a command that’s so destructive.

      • TeamAssimilation@infosec.pub
        link
        fedilink
        arrow-up
        0
        ·
        21 hours ago

        I guess cancelling would go back to the “Then you want to commit all files?” dialog, which the user didn’t want to, he just wanted to cancel whatever the IDE was trying to start.

        • Pyro@programming.dev
          link
          fedilink
          arrow-up
          0
          ·
          20 hours ago

          It’s not that. It means discard all changes made after the last change committed to this local repository.

        • mark3748@sh.itjust.works
          link
          fedilink
          arrow-up
          0
          ·
          20 hours ago

          Then you don’t understand git or source control in general. If you don’t commit your changes, then you discard any changes, you’re set back to the last commit. Discarding changes also includes any un-committed new files.

          • tyler@programming.dev
            link
            fedilink
            arrow-up
            0
            ·
            16 hours ago

            discarding changes does not discard uncommitted new files. The VS Code button did a git clean which is completely unexpected. Git even refers to a git clean with completely different terminology.

            git reset -> “Resets the index and working tree. Any changes to tracked files in the working tree since are discarded.

            git clean -> “Cleans the working tree by recursively removing files that are not under version control, starting from the current directory.”. This command also requires you to specify a force option to actually do something, else it quits with an error.

            Note that git clean never once refers to discarding anything, and git reset never refers to removing untracked files. VS Code was doing an idiotic thing. Running git reset --hard AND git clean. There is absolutely no reason to be running git clean from an UI button ever. If you want to remove a file you can explicitly remove it.

            Imagine that the button said “Discard all changes” and then it ran rm -rf --no-preserve-root /*. Would that make sense as a button? No. It definitely would not.

          • onlinepersona@programming.dev
            link
            fedilink
            English
            arrow-up
            0
            ·
            20 hours ago

            Which is exactly the situation the dude was in. As a newbie, it’s an easy mistake to make. Telling somebody who doesn’t know “well, would you look at that, you didn’t know!” is not just unhelpful, it’s useless and condescending.

            Anti Commercial-AI license

        • subignition@fedia.io
          link
          fedilink
          arrow-up
          0
          ·
          20 hours ago

          It’s changes from the prior commit in the repository, which, if they had not committed anything prior, would have been an empty directory.

          This is perhaps a good lesson in teaching version control as its own concept rather than “streamlining it” by bundling it with an editor.

          • Scubus@sh.itjust.works
            link
            fedilink
            arrow-up
            0
            ·
            20 hours ago

            Ok then, the changes to the repository shouldve been discarded. Anything he uploaded shouldve been deleted from the server. Why were files on his local machine deleted?

            • subignition@fedia.io
              link
              fedilink
              arrow-up
              0
              ·
              18 hours ago

              What makes you think a server was involved here? It was a local repository, evidenced by the reporter’s bewilderment that files can be deleted without going to the Recycle Bin first. Which tells us that in addition to VCS, they were unfamiliar with Windows as well.

              • Scubus@sh.itjust.works
                link
                fedilink
                arrow-up
                0
                ·
                17 hours ago

                Admittedly i dont use source control myself as im a hobbiest, but I didnt realize that git was local. As for the recycle bin bit, yeah theyre kinda dumb. Is source control different from git?

                • WolfLink@sh.itjust.works
                  link
                  fedilink
                  arrow-up
                  0
                  ·
                  edit-2
                  8 hours ago

                  You may be confusing git with GitHub.

                  git is a version control tool that lets you keep and manage a history of the files you are editing

                  GitHub is a website (not directly affiliated with the group maintaining git) that lets you upload, backup, and share your code using the format used by the git tool.

                  source control just refers to software to manage your source code in some form. git is the most popular tool of its kind, but there are others, for example mercurial.

                • subignition@fedia.io
                  link
                  fedilink
                  arrow-up
                  0
                  ·
                  17 hours ago

                  Hobbyist myself so no worries! Git is one example of source control / version control software. You normally have your local working copy of a repository and then a remote where you push your changes when they are finished or to share them with others.

          • conciselyverbose@sh.itjust.works
            link
            fedilink
            arrow-up
            0
            ·
            20 hours ago

            You shouldn’t be taking ownership of files and then deleting them without communication a hell of a lot better than that.

            I understand what happened. I’m saying that if you’re going to delete stuff that was there before the software was, your flow to adding a project should include suggesting a base level commit of everything that’s there already.

            • subignition@fedia.io
              link
              fedilink
              arrow-up
              0
              ·
              18 hours ago

              That’s definitely fair, creating a repository in a non-empty directory could definitely suggest auto-committing the current state if it doesn’t already. I don’t use VSCode so I wouldn’t know.

              Although now that I think about it, that could have been the intention here but not automatic, if that’s why 5k+ files were staged without the user explicitly staging them. Extra tragic if that’s the case.

              • T156@lemmy.world
                link
                fedilink
                English
                arrow-up
                0
                ·
                13 hours ago

                Although now that I think about it, that could have been the intention here but not automatic, if that’s why 5k+ files were staged without the user explicitly staging them. Extra tragic if that’s the case.

                From the git discussions around the issue, it wasn’t that the files were automatically staged, but that the “discard all changes” feature invoked a git clean, and also deleted untracked files.

                Since OP’s project wasn’t tracked, it got detonated.