Git rebase -I is not that scary
by vinhnx on 7/26/2026, 12:37:54 AM
https://cachebag.sh/journal/interactive-rebasing/
Comments
by: flyingcircus3
After more than a decade of using git, I know that my comfort with rebase, and confidence that I wont make an error I can't undo, comes from knowing that I can always abort. And assuming it wasn't garbage collected, I can always get back to orphaned commits, or the commit before I rebased, as long as I keep their hashes. I can definitely look back on my less confident days as times when I wrongly assumed I was walking a tightrope where screwing up was painful and expensive, and easy to take the wrong path, and abort is the universal solvent to all of that.<p>I do still find myself tripping up on whether the next appropriate step is to make a commit or continue the rebase, as that is dependent on if you're in a merge conflict or just editing a commit. But even when I get that wrong, and collapse two commits together, abort saves the day.
7/26/2026, 2:40:21 AM
by: maxloh
I found the VS Code GitLens extension to be a good abstraction for interactive rebase. It provides a drag-and-drop UI with a dropdown to select actions applied to each commit. That is much easier than editing a text file.<p>Here's a GIF I found with Google: <a href="https://yogwang.site/2025/cursor-vscode-gitlens-rebase-editor/rebase.gif" rel="nofollow">https://yogwang.site/2025/cursor-vscode-gitlens-rebase-edito...</a>
7/26/2026, 3:23:00 AM
by: nixpulvis
I feel like if you're scared of rebasing, you don't actually understand git.
7/26/2026, 2:32:25 AM
by: koolba
That “-I” really needs to be lowercase.
7/26/2026, 2:50:49 AM
by: KoleSeise1277
I still make a throwaway branch before a complicated rebase. It costs nothing and turns the whole operation into a low-stakes edit instead of a leap of faith.
7/26/2026, 3:24:06 AM
by: ed_mercer
I cannot recall the last time I committed manually, let alone rebase manually. An agent can do it for you faster and without making mistakes.
7/26/2026, 3:38:09 AM
by: jordanboxer
<p><pre><code> git commit —fixup=<commit-id> git rebase -i —autosquash </code></pre> This is my best friend
7/26/2026, 3:24:58 AM
by: TazeTSchnitzel
I wish there were a shorthand for<p><pre><code> x git commit --amend --reset-author --no-edit </code></pre> I use that one very frequently (after a fixup, of course) because I want the author date on amended commits to reflect the last time I edited them, not the first time I committed them.
7/26/2026, 2:10:49 AM
by: BobbyTables2
I also thought rebase was scary long ago. It is scary in the sense if one messes something up without realizing and then pushes to master…<p>Besides interactive rebase, my other favorite command is “git log —-oneline origin/master..HEAD”<p>It shows me exactly where I am…
7/26/2026, 2:38:40 AM
by: newsicanuse
I use rebase so much but it only feels comfortable because I follow a workflow while rebasing.
7/26/2026, 2:50:50 AM
by: code_lettuce
Big rebase fan here. I find myself using squash the most.
7/26/2026, 2:23:14 AM
by: trescenzi
Another git command I love using is `git add -p`. I always want to commit in chunks as I go but sometimes I wait to long or realize later I could have broken it up. Being able to select only pieces of a file to add to a specific commit is so great. Editing the chunks manually can be a bit intimidating but since it only stages the change you can always restore the file and try again if the diff doesn't look right after the add.
7/26/2026, 2:48:48 AM
by: cmrdporcupine
I really love the emacs interactive rebase mode, which comes up by default when you have EDITOR=emacs and do rebase -i.<p>I know you can do this from within magit as well but I've never gotten into that workflow.
7/26/2026, 2:42:06 AM
by: dionian
sometimes i wish mercurial won, if nothing else for the fact that i found its ux to be more enjoyable. I respect and use git, but never got comfortable with merging. im thankful AI can automate it for me now
7/26/2026, 3:11:57 AM
by: jauntywundrkind
rebase interactive is so great, such a powerful tool.<p>it's the one clear tool that i used all the time. moving to jj, it has lots of amazing tools starting with `jj edit` to go change the past safely & conveniently, with much less pain. but i miss the direct powerful data-driven experience of seeing the timeline in a text file, and picking what to do with it. sometimes.<p>imo every dev should work to get some competency with git rebase! it's an amazing tool. there's few other systems that give such direct control. it's top layer is, perhaps, the excel of version control?
7/26/2026, 2:02:39 AM