@phpstorm “Local History” saves my *ss for a second time after I “reset hard” my git repo in the wrong folder containing quite some uncommitted code.

  • FizzyOrange
    link
    fedilink
    arrow-up
    4
    ·
    12 days ago

    Asking for it if you git reset --hard with uncommitted changes tbh… I feel like Git shouldn’t let you do that by default, but that would make Git slightly user friendly so I guess we can’t have that!

    Glad you recovered your code anyway!

    • Djumaka@phpc.socialOP
      link
      fedilink
      arrow-up
      2
      ·
      11 days ago

      @FizzyOrange Oh why this should not happen is a material to a whole book or at least a conf talk :D you know, commit at least daily, you should not have a 3d task worth of code and etc.

      And what is the karma roundhouse-kick - I’ve been preaching about the bus factor in my team myself :D

    • Kissaki
      link
      fedilink
      English
      arrow-up
      1
      ·
      11 days ago

      How would you discard all/numerous changes without a hard reset?

      • FizzyOrange
        link
        fedilink
        arrow-up
        1
        ·
        11 days ago

        I normally click the “discard all changes” button in VSCode and it asks me if I am sure. That confirmation dialog has saved me a few times!

        From the command line I’d normally git checkout . and git clean -ffxd. I guess you could say it’s no different to git reset --head HEAD in a sense…