• thanks_shakey_snake@lemmy.ca
    link
    fedilink
    arrow-up
    0
    ·
    6 months ago

    You can get in some pretty serious messes, though. Any workflow that involves force-pushing or rebasing has the potential for data loss… Either in a literally destructive way, or in a “Seriously my keys must be somewhere but I have no idea where” kind of way.

    When most people talk about rebase (for example) being reversible, what they’re usually saying is “you can always reverse the operation in the reflog.” Well yes, but the reflog is local, so if Alice messes something up with her rebase-force-push and realizes she destroyed some of Bob’s changes, Alice can’t recover Bob’s changes from her machine-- She needs to collaborate with Bob to recover them.

    • expr@programming.dev
      link
      fedilink
      arrow-up
      0
      ·
      6 months ago

      Pretty much everything that can act as a git remote (GitHub, gitlab, etc.) records the activity on a branch and makes it easy to see what the commit sha was before a force push.

      But it’s a pretty moot point since no one that argues in favor of rebasing is suggesting you use it on shared branches. That’s not what it’s for. It’s for your own feature branches as you work, in which case there is indeed very little risk of any kind of loss.

      • aubeynarf@lemmynsfw.com
        link
        fedilink
        arrow-up
        1
        ·
        edit-2
        5 months ago

        If “we work in a way that only one person can commit to a feature”, you may be missing the point of collaborative distributed development.