• mvirts@lemmy.world
    link
    fedilink
    arrow-up
    22
    ·
    3 hours ago

    Obligatory mention of file recovery as an option if you get in this situation.I recommend testdisk but there are other more gui friendly options.

    NTFS takes a relatively long time to destroy the data so chances of recovery are good on Windows.

  • _____@lemm.ee
    link
    fedilink
    English
    arrow-up
    80
    arrow-down
    1
    ·
    4 hours ago

    let’s turn this into a constructive angle for future devs and current juniors: just learn git cli, I promise you it is much simpler than it seems.

    all those memes about git having like a thousand commands are true, but you really will only use like 7 at most per month.

    learn push, pull, merge, squash, stash, reset, im probably missing like one or two

    I promise you again: it is much simpler than it seems. and you won’t have to use these stupid git GUI things, and it will save you a hassle because you will know what commands you are running and what they do

    short disclaimer: using git GUI is totally fine but low-key you are missing out on so much

    • MajorasMaskForever@lemmy.world
      link
      fedilink
      English
      arrow-up
      10
      arrow-down
      1
      ·
      3 hours ago

      Every time I mentor a dev on using git they insist so much on using some GUI. Even ones who are “proficient” take way longer to do any action than I can with cli. I had one dev who came from SVN land try and convince me that TortoiseGit was the only way to go

      I died a little that day, and I never won her over to command line despite her coming to me kinda regularly to un-fuck her repository (still one of the best engineers I ever worked with and I honestly miss her… Just not her source control antics)

      • dave@feddit.uk
        link
        fedilink
        English
        arrow-up
        3
        ·
        3 hours ago

        So I’m normally a command line fan and have used git there. But I’m also using sublimerge and honestly I find it fantastic for untangling a bunch of changes that need to be in several commits; being able to quickly scroll through all the changed files, expand & collapse the diffs, select files, hunks, and lines directly in the gui for staging, etc. I can’t see that being any faster / easier on the command line.

      • Antiproton@programming.dev
        link
        fedilink
        arrow-up
        2
        arrow-down
        1
        ·
        3 hours ago

        The difference in speed is familiarity, not some inherent efficiency gain by typing commands into the cli.

    • thebestaquaman@lemmy.world
      link
      fedilink
      arrow-up
      4
      ·
      3 hours ago

      I use gitkraken for two primary purposes:

      1. Having a visual representation of my project history.

      2. resolving merge conflicts

      Of these, the first is really the only thing I really want a GUI for. I’ll just have it open on my side-screen if I’m managing some more or less messy branch structure or quickly want an overview of what has been done on which branches, where common ancestors are, etc. All the actual doing of things is done from the CLI, because it’s just better for that.

    • Cethin@lemmy.zip
      link
      fedilink
      English
      arrow-up
      4
      ·
      edit-2
      3 hours ago

      Personally, I’m pretty good with the CLI version, but sometimes I just use the Code VC interface. For some tasks (basic commit, pull, push) it’s pretty fast. I don’t know if it’s faster than CLI, but I switch between them depending on what I’m doing at that moment. Code has a built in console, so using either is pretty seemless and easy. If you only use the GUI you won’t ever understand it though. I think everyone should start with CLI.

      Honestly, this is true for almost everything. GUIs obfiscate. They don’t help you learn, but try to take control away so you can’t mess up, and as an effect can’t do everything you may want.

  • LANIK2000@lemmy.world
    link
    fedilink
    arrow-up
    23
    arrow-down
    5
    ·
    4 hours ago

    Honestly no idea why someone would go around a completely unknown menu in a new unknown editor and randomly click things with caution completely out the window. Not having a copy or trying a blank project, not even reading any messages. I mean even if we don’t know it’s a nuke button, God knows what other edits it could do to your code without you knowing.

    This goes beyond rookie mistake. This is something 12 year old me would do. Same with the issue page being 90% swear words.

    • Cethin@lemmy.zip
      link
      fedilink
      English
      arrow-up
      9
      arrow-down
      2
      ·
      3 hours ago

      This is a disease of GUIs. Most people are so used to having their hands held and being unable to make a mistake that when a GUI actually gives you the power to fuck up they don’t expect it. I promise you, if this user was using the CLI, this wouldn’t have happened as easily.

    • calcopiritus@lemmy.world
      link
      fedilink
      arrow-up
      12
      arrow-down
      1
      ·
      4 hours 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
        6
        ·
        2 hours 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.

      • Cethin@lemmy.zip
        link
        fedilink
        English
        arrow-up
        2
        ·
        3 hours 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.

  • AnAmericanPotato@programming.dev
    link
    fedilink
    English
    arrow-up
    94
    arrow-down
    1
    ·
    7 hours ago

    I feel bad for this kid. That really is a bad warning dialog. Nowhere does it say it’s going to delete files. Anyone who thinks that’s good design needs a break.

    Half the replies are basically “This should be obvious if your past five years of life experience is similar to mine, and if it isn’t then get fucked.” Just adding insult to injury.

    • Omega_Jimes@lemmy.ca
      link
      fedilink
      arrow-up
      46
      arrow-down
      2
      ·
      5 hours ago

      I’m not great at English, but “discard all changes” shouldn’t ever mean “Delete”.

      • stebo@lemmy.dbzer0.com
        link
        fedilink
        arrow-up
        3
        ·
        2 hours ago

        I’m pretty sure vscode shows a confirmation dialog when discarding changes will permanently delete a file. I’ve done that recently with temporary files that were no longer needed.

        • GreenAppleTree@lemmy.world
          link
          fedilink
          arrow-up
          1
          ·
          16 minutes ago

          I remember following the drama back in the day. That warning you saw was the result of this now-classic bug report.

      • Michal@programming.dev
        link
        fedilink
        arrow-up
        30
        arrow-down
        5
        ·
        5 hours ago

        In the context of version control it does. Discarding a change that creates a file means deleting the file.

        • thebestaquaman@lemmy.world
          link
          fedilink
          arrow-up
          5
          ·
          2 hours ago

          If you have set up your staging area for a commit you may want to discard (unstage) changes from the staging area, as opposed to discarding changes in the working directory.

          Of course, the difference between the two is obvious if you’re using git CLI, but I can easily see someone using a GUI (and that maybe isn’t too familiar with git) misunderstanding “discard” as “unstage”.

          Either way, what happened here indicates that all the files were somehow added to the VC, without having been committed first, or something like that, because git will not let you discard a file that is untracked, because that wouldn’t make any sense. The fact that the GUI let this person delete a bunch of files without first committing them to the index is what makes this a terrible design choice, and also what makes the use of the word “discard” misleading.

        • Omega_Jimes@lemmy.ca
          link
          fedilink
          arrow-up
          3
          arrow-down
          1
          ·
          3 hours ago

          Ok fair enough, but I’m under the impression these files existed before the source control was implemented.

          I guess it’s all up to how the program handles existing files.

          • FiskFisk33@startrek.website
            link
            fedilink
            arrow-up
            2
            ·
            2 hours ago

            I guess the newly created git repository was empty, and all the files that was present in the folder represented “changes”

    • cocobean@bookwormstory.social
      link
      fedilink
      English
      arrow-up
      32
      ·
      6 hours ago

      Also, why not send them to the recycle bin? I never really thought about it before, but that does seem a reasonable UX improvement for this case

      • murtaza64@programming.dev
        link
        fedilink
        arrow-up
        2
        ·
        4 hours ago

        I wonder if there’s already a git extension to automatically stash the working tree on every clean/reset/checkout operation…

      • stetech@lemmy.world
        link
        fedilink
        arrow-up
        3
        arrow-down
        1
        ·
        4 hours ago

        Because “the underlying Git nukes them right away, so why shouldn’t we perma-delete the files, too?”

        Anything else’d be effort…

    • GreenAppleTree@lemmy.world
      link
      fedilink
      arrow-up
      1
      ·
      1 minute ago

      Even reset hard wouldn’t delete untracked files. This was a complete overreach by the GUI, performing a clean (and likely a forced one, as git’s requireForce defaults to true).

      And they did rectify that eventually, giving a warning, and an option to simply reset. It’s unfortunate this poor person had to be the trigger for that change.

  • Artyom@lemm.ee
    link
    fedilink
    arrow-up
    23
    arrow-down
    3
    ·
    6 hours ago

    If you ever happen to have 5000 uncommitted files, you shouldn’t be asking yourself if you should commit more often. You should be asking yourself how many new repos you should be making.

    • Korne127@lemmy.world
      link
      fedilink
      arrow-up
      38
      ·
      6 hours ago

      The person didn’t have any git repository; probably a new programmer that didn’t know how version control works and just clicked discard without understanding what that means in this situation.

      • ByteOnBikes@slrpnk.net
        link
        fedilink
        arrow-up
        11
        arrow-down
        1
        ·
        4 hours ago

        This person is why we have that meme where devs would rather struggle for a week than spend a few hours reading the documentation.

  • aliser@lemmy.world
    link
    fedilink
    arrow-up
    28
    ·
    9 hours ago

    deleted a chunk of my work the other day by pressing Ctrl z in windows explorer. my project was without source control installed (cuz it was in Dev stage), and Ctrl shit z/Ctrl y hotkeys didn’t work, so that chunk was just gone, persished forever… or so I though. I remembered vs code having a file history under some panel. found it, and here it was - at least some of the latest history of my file. lesson learned: even in Dev where nothing is yet working, finish your day of coding with a commit to a remote repo.

      • locuester@lemmy.zip
        link
        fedilink
        English
        arrow-up
        6
        ·
        3 hours ago

        Makes no sense to me. I’ve never had a single problem. Best ide I’ve ever used.

      • Cethin@lemmy.zip
        link
        fedilink
        English
        arrow-up
        2
        ·
        3 hours ago

        (VS)Code(ium) is great. (VSCode is MS fork of the OSS Codium.) It’s a popular editor with a lot of plugin for just about every language. It has an integrated console. It can do basic Version control (and you can use the console for anything more). It’s my favorite editor/IDE (not technically and IDE, at least out of the box). Just don’t do things you don’t understand. It’s that simple. The OP fucked around, and they found out what it does the hard way. It’s really easy to use if you have a basic understanding of things though.

      • Dragon Rider (drag)@lemmy.nz
        link
        fedilink
        English
        arrow-up
        9
        ·
        5 hours ago

        You can avoid this problem by not doing version control in your code editor. Different programs for different purposes. VS Code is fine for editing code and should not be used to manage an entire project.

      • tiredofsametab@fedia.io
        link
        fedilink
        arrow-up
        6
        ·
        6 hours ago

        I begrudgingly switched to vscode a few years ago. I’ve never had any issues like this with it. My only issues have been with a plugin that I installed optionally (and that was later fixed by the plugin author).

    • Korne127@lemmy.world
      link
      fedilink
      arrow-up
      9
      arrow-down
      1
      ·
      6 hours ago

      The person didn’t have any git repository; probably a new programmer that didn’t know how version control works and just clicked discard without understanding what that means in this situation

    • Mixel@feddit.org
      link
      fedilink
      English
      arrow-up
      86
      ·
      12 hours ago

      I have heard things from another apprentice who just does not use version control at all and the only copies are on his laptop and on his desktop. He is also using node.js with only 1 class and doesn’t know about OOP (not sure if you even use that in js no clue 😅) and has one big file with 20k lines of code I have absolutely no clue how he navigates through it

      • LANIK2000@lemmy.world
        link
        fedilink
        arrow-up
        5
        ·
        edit-2
        4 hours ago

        Ey! Reminds me of my middle-school years! I still can’t belive I made an entire game without a single class… Just storing info in arrays and writing in comments what location represents what data. But I was a literal child, too young to read guides or sit through “long” tutorials.

        I don’t want to sound too mean, but whenever I see anything similar at work, I wish that person get a job they’re actually good at. It’s fine and all that the company started hiring actual programmers to fix things, but the fact that the old crew still fucks shit up with senior privileges is a major grievance.

      • e8d79@discuss.tchncs.de
        link
        fedilink
        arrow-up
        70
        ·
        12 hours ago

        I know the type. Usually the kind of confident know-it-all who refuses to learn anything but delivers changes really quickly so management loves them. I had the misfortune to fix such a project after that ‘rock-star’ programmer left the company. Unfortunately the lack of professional standards in our industry allows people like that to continuously fail upwards. When I left the project they rehired them and let them design the v2 of the project we just fixed.

        • LANIK2000@lemmy.world
          link
          fedilink
          arrow-up
          7
          ·
          4 hours ago

          Jesus, reminds me of a similar story. My gf once lost a job to someone who literally just pasted code into LLMs, also delivering quickly, even tho it was hot garbage. Anyhow, she spent a lot of her time fixing his shit and so her output went down. I hope that company burns to the ground with completely un manageable software.

        • RagingRobot@lemmy.world
          link
          fedilink
          arrow-up
          15
          ·
          7 hours ago

          My company for the longest time had two engineers they would give all the new projects to. They would rush through some prototype code as fast as they could then management would bring in a new team to take the project over. The code was always garbage and crammed into one place. I kept getting new projects and instead of starting from a nice clean slate we always had to build on that garbage. It sucked so bad.

        • MajorHavoc@programming.dev
          link
          fedilink
          arrow-up
          11
          ·
          7 hours ago

          When I left the project they rehired them and let them design the v2 of the project we just fixed.

          Lol. Wow.

          And that is why I’ve been unable to work myself out of a job in all my long years as a developer.

      • Blackmist@feddit.uk
        link
        fedilink
        English
        arrow-up
        13
        ·
        9 hours ago

        Those are rookie numbers. I have at least a 35k one somewhere. More than one actually.

        People run their businesses on this.

        • fibojoly@sh.itjust.works
          link
          fedilink
          arrow-up
          2
          ·
          4 hours ago

          I once landed a job at a small company doing a software for medical analysis labs all over the country. Software had been around for over ten years at this point. They had no source control. Nothing. Absolute nightmare.
          They were literally starting to use source control when I arrived.
          In 2015.

          • Blackmist@feddit.uk
            link
            fedilink
            English
            arrow-up
            3
            ·
            2 hours ago

            The “source control” when I first started was all the code on a shared drive, to check out a file you copied it to your machine, and renamed the extension on the shared drive to your initials.

            When somebody edited without doing this there would be full blown meltdowns over lost work.