• ulkesh@beehaw.org
    link
    fedilink
    English
    arrow-up
    6
    arrow-down
    1
    ·
    10 months ago

    And what this graphic fails to discuss is that all these methods should be done BEFORE pushing. Once pushed, then the hashes are set and if you do any squashing, fixuping, etc, then you are rewriting hashes (and history) — and possibly orphaning other developers local copy.

    • linuxPIPEpower
      link
      fedilink
      arrow-up
      2
      ·
      edit-2
      10 months ago

      wait what

      could this be why I’ve failed to understand this topic on several occasions? I don’t remember anything about push timing.

      before you push what specifically?

      And what if you accidentally push too soon?

      • ulkesh@beehaw.org
        link
        fedilink
        English
        arrow-up
        3
        ·
        10 months ago

        The moment you push your changes to origin, other developers can then pull them. If you intend to squash or fixup commits, then you should do so after committing to your local git, but before you push to origin.

        Once you push to origin, the commit hashes from your local branch become what origin has, and then those commit hashes are now possibly on another developer computer after they pull.

        If you do a squash or a fixup, the existing commits are effectively rewritten into a new commit with a new hash so the developers who happened to pull what you previously pushed now have their HEAD pointing to a hash that no longer exists — thus orphaning.