• calcopiritus@lemmy.world
    link
    fedilink
    arrow-up
    19
    ·
    12 days ago

    I don’t even know why people ITT are blaming the IDE and completely ignoring this.

    When you learn git, you do so on a dummy project, that has 5 files which are 10 characters long each.

    An IDE is not made so you can’t break things, it is tool, and it should let you do things. It’s like complaining that Linux will let you delete your desktop environment. Some people actually want to delete your desktop environment. You can’t remove that option just because someone can accidentally do it by ignoring all the warnings.

    • thebestaquaman@lemmy.world
      link
      fedilink
      arrow-up
      12
      ·
      12 days ago

      Got will not delete untracked files though, which is what happened here. If you want to discard changes to a file with git, you first have to commit the file to the index at some point, which means there’s only ever so much damage an erroneous “git restore” or “git reset” can do. Specifically, neither of them will delete all the files in an existing project where VC has just been added.

      • calcopiritus@lemmy.world
        link
        fedilink
        arrow-up
        5
        ·
        12 days ago

        This user was not using git though, he was using vs code. That button doesn’t say “git reset” it says “discard all changes”. And btw, what it does is “git clean”, which is something that git can do.

        Just below the button there is a list of all the changes. In his case, there were 3000 changes of the type “file creation”. Discarding a file creation can only be made one way: deleting the file.

        Anyway, this user is presumably in his learning phase, I would not assume that he knows what git reset or git restore actually do.

        • Hawk@lemmy.dbzer0.com
          link
          fedilink
          English
          arrow-up
          2
          ·
          12 days ago

          In other IDEs this discards tracked changes, untracked files usually stay untouched.

          In my opinion, it’s a combination of user error and bad implementation here

    • Cethin@lemmy.zip
      link
      fedilink
      English
      arrow-up
      5
      ·
      12 days ago

      They could have a warning though. I agree with you, but there are some easy ways to prevent this from happening. It just takes time to implement, and would be required in other places too. Is it worth the dev time? I doubt it.

      • calcopiritus@lemmy.world
        link
        fedilink
        arrow-up
        4
        ·
        12 days ago

        There is a warning. IIRC it says “are you sure you want to discard all changes? This action is unreverisble”. In the context of version management. Creating a file is a change. And just below the button to discard all changes is the list of changes. In that list he could’ve seen 3000 changes of the type “file creation”, when you discard a file creation, it means to undo the creation, which is a deletion.

        The button days what is going to do. There is a warning about what it’s going to do. And there is a list of the exact changes it’s going to undo.

        The only way to avoid this from happening is to not have the button exist. In that case, the users that actually want to discard all changes would be unable to do so.