Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo

agnos.is Forums

  1. Home
  2. Programming
  3. Is there a way to rewind the git rebase state?

Is there a way to rewind the git rebase state?

Scheduled Pinned Locked Moved Programming
programming
25 Posts 10 Posters 82 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • Q [email protected]

    How does cherry picking improve the workflow? I'm not sure I understand, is it so you can keep the original branch as reference and know where you could have screwed up if it happens?

    M This user is from outside of this forum
    M This user is from outside of this forum
    [email protected]
    wrote on last edited by
    #21

    is there a way to move commit out of the way Todo later?

    This is what cherry-pick does for me. Now that the work is all done, I can cherry-pick the commits into the new branch in any order I find convenient (and often in an order that causes fewer git conflicts, or no git conflicts to resolve.)

    Note that this approach is much stronger if the original commits are fairly focused and purposeful.

    In extreme cases, I stop and rebase the new or old branch to clean up the commits before I cherry-pick them onto the same branch.

    In essence, all of these techniques are just ways for me to very slowly and methodically organize thoughts, using git.

    Also, sometimes it's all too messy and I just copy and paste all the change I need into a fresh clean branch.

    Q 1 Reply Last reply
    0
    • Q [email protected]

      Not exactly, because n commits will have been squashed into one, so making the edit would lose the reference to the originals which should have been squashed with other commits, visually maybe this helps:

      A (pick) -> B (squash) -> C (squash) -> D (pick)
      

      When it should have been:

      A (pick) -> B (squash) -> D (pick) -> C (squash)
      

      I had just created A+B+C, then realised C should have been out

      footfaults@lemmygrad.mlF This user is from outside of this forum
      footfaults@lemmygrad.mlF This user is from outside of this forum
      [email protected]
      wrote on last edited by
      #22

      Not exactly, because n commits will have been squashed into one, so making the edit would lose the reference to the originals which should have been squashed with other commits

      See but you can break the commit back apart by doing a git rebase interactive, selecting that squashed commit as the commit to edit, then doing a git reset HEAD~1 then recommit it in pieces, then git rebase --continue

      Q 1 Reply Last reply
      0
      • M [email protected]

        is there a way to move commit out of the way Todo later?

        This is what cherry-pick does for me. Now that the work is all done, I can cherry-pick the commits into the new branch in any order I find convenient (and often in an order that causes fewer git conflicts, or no git conflicts to resolve.)

        Note that this approach is much stronger if the original commits are fairly focused and purposeful.

        In extreme cases, I stop and rebase the new or old branch to clean up the commits before I cherry-pick them onto the same branch.

        In essence, all of these techniques are just ways for me to very slowly and methodically organize thoughts, using git.

        Also, sometimes it's all too messy and I just copy and paste all the change I need into a fresh clean branch.

        Q This user is from outside of this forum
        Q This user is from outside of this forum
        [email protected]
        wrote on last edited by
        #23

        I see, now that makes sense to me as well! I too make commits messily as thoughts crop up, so I think this technique might be good for me in some cases, thanks!

        1 Reply Last reply
        0
        • footfaults@lemmygrad.mlF [email protected]

          Not exactly, because n commits will have been squashed into one, so making the edit would lose the reference to the originals which should have been squashed with other commits

          See but you can break the commit back apart by doing a git rebase interactive, selecting that squashed commit as the commit to edit, then doing a git reset HEAD~1 then recommit it in pieces, then git rebase --continue

          Q This user is from outside of this forum
          Q This user is from outside of this forum
          [email protected]
          wrote on last edited by
          #24

          I know, but that feels really clunky to me, like an unclean solution, I know that commit will disappear regardless, but I don't like room for more human error like that by manually re-editing

          footfaults@lemmygrad.mlF 1 Reply Last reply
          0
          • Q [email protected]

            I know, but that feels really clunky to me, like an unclean solution, I know that commit will disappear regardless, but I don't like room for more human error like that by manually re-editing

            footfaults@lemmygrad.mlF This user is from outside of this forum
            footfaults@lemmygrad.mlF This user is from outside of this forum
            [email protected]
            wrote on last edited by
            #25

            Don't know what to tell you. Been doing it that way since 2011

            1 Reply Last reply
            0
            • System shared this topic on
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups