Git: avoid reset --hard, use reset --keep instead - eviltoast
  • thesmokingman@programming.dev
    link
    fedilink
    arrow-up
    4
    ·
    2 months ago

    I do not actually understand the use case of —keep over the default mixed, which I use regularly to restage patches or fuckups. I very frequently use —hard to test something out and blow it away without worrying about any changes. This whole conversation is fascinating because it highlights just how different everyone uses git and equally how bad sweeping generalizations like “—hard is something to avoid” are (without incredibly specific caveats).

    It seems like —keep makes sense if you’re not using stash before trying to change history when you have local, uncommitted changes? That might be why it’s not clicking with me; any time I fuck with history I stash anything local I might want to keep.