3 ms·
I also get tons of mileage out of This One Weird Trick: make a new branch first. Every single time it appears non-trivial, just abort and branch before continu
by Groxx 9mo ago
I also get tons of mileage out of This One Weird Trick: make a new branch first. Every single time it appears non-trivial, just abort and branch before continuing.
Then if you screw up, even several steps later when it's hard to un-rebase a portion, you just go back to the original. No need to dig through the ever-confusing reflog format, just use branches. For really gnarly ones, it also means you can early compare the two diffs to see if you missed anything.
Once you're fully happy with it, you can push that new one, or just go back to your original and `git reset --hard after-rebase-branch` to adopt the new history.
- tigerlily 9mo agoI do this, and with TortoiseGit I just pick and choose the good bits and put them as atomic changes in their own branches and PRs.
- yowlingcat 9mo agoThis is the way. Branches are structurally cheap in git for a reason - to make it easy to do this! The only minor pain is that then I have to remember to clean up the unused branches for paths that didn't pan out but that isn't so bad anyways and helps me make sense of/remind me of what didn't work as I was trying to solve something.
- Groxx 9mo agobranch-rebase-3-final_2_DO-NOT-EDIT---IN-PROD-incident_93473672 The struggle is real. I generally have a "show branches by age" script to help that a bit