As the title says. I put the wrong value inside a clean up code and I wiped everything. I did not push any important work. I just want to cry but at least I can offer it to you.

Do not hesitate to push even if your project is in a broken state.

  • wheezy@lemmy.ml
    link
    fedilink
    arrow-up
    0
    ·
    edit-2
    4 hours ago

    I did a “rm -rf *” in the wrong directory today.

    I got the absolutely beautiful “argument list too long” in return.

    I had a backup. But holy shit I’m glad the directory had thousands of files in it and nothing happened. First time I got that bash error and was happy.

    I usually have rm aliased to “trash” or whatever that cli based recycle bin is. But just installed a new OS and ran this on a NAS folder today by mistake.

    • lauha@lemmy.world
      link
      fedilink
      arrow-up
      0
      ·
      17 hours ago

      Version control would be quite adequate if using a sane amount of time between pushes

      • Except that one is automatically versioned and would have saved you this pain, and the other relies on you actively remembering to reflexively commit, and then do extra work to clean up your history before sharing, and once you push, it’s harder to change history and make a clean version to share.

        These days, there’s little excuse to not use COW with automated snapshots in addition to your normal, manual, VCS activities.

      • HelloRoot@lemy.lol
        link
        fedilink
        English
        arrow-up
        0
        ·
        edit-2
        16 hours ago

        I’m paranoid. I have like 5 different ways (including 3-2-1 backups) to restore everything. COW fs is great for stuff that is not a git-able project.

  • Rolling Resistance@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    18 hours ago

    Sorry this happened.

    Use it as an opportunity to learn how to better store and edit your code (e.g. a VCS and a smart-ish editor). For me, a simple Ctrl-Z would be enough to get my code back.

  • Aganim@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    19 hours ago

    On the bright side, you’ve now got squeaky clean disk space to fill with new projects!

  • tias@discuss.tchncs.de
    link
    fedilink
    arrow-up
    0
    ·
    21 hours ago

    I keep my git clone in Dropbox so I can revert accidental delete and always have the most recent code on all devices without having to remember to commit and push. If it requires manual execution I wouldn’t really consider it a proper backup solution.

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

      I have been burnt by Dropbox in the past so now use Syncthing between my desktop, laptop, and a private remote server with file versioning turned on. Trivial to global ignore node_modules, and not giving data to a third party.

      It’s saved me on several occasions.

  • Mist101@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    22 hours ago

    I have a separate usb harddrive for just this occasion. My lazy ass just likes to play "We backed it up last time, do we need to do it every time?

  • Vince@lemmy.world
    link
    fedilink
    arrow-up
    0
    ·
    23 hours ago

    Oh man, I hate losing code. Last time it happened I spent more time trying to recover it than it would’ve taken to rewrite it.