Git rebase -I is not that scary(cachebag.sh) |
Git rebase -I is not that scary(cachebag.sh) |
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.
Here's a GIF I found with Google: https://yogwang.site/2025/cursor-vscode-gitlens-rebase-edito...
Plus you can always take a note of the commit hash before you do anything crazy. But reflog means you don't have to.
Git really does have all the features you need. I wouldn't argue with anyone complaining about the UI to get there. But it's all in there somewhere.
git commit —fixup=<commit-id>
git rebase -i —autosquash
This is my best friend git history fixup <commit-id>
https://git-scm.com/docs/git-history#Documentation/git-histo... x git commit --amend --reset-author --no-edit
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. > git config --global alias.whatever_you_want 'commit --amend --reset-author --no-edit'
https://git-scm.com/book/ms/v2/Git-Basics-Git-AliasesBesides interactive rebase, my other favorite command is “git log —-oneline origin/master..HEAD”
It shows me exactly where I am…
pick a1b2c3d Add user model
s e4f5g6h Fix typo in user model
pick i7j8k9l Add login endpoint
s m0n1o2p WIP debugging login endpoint
s feedbee fixed login endpoint
s deadbee fixed login endpoint
s adebade fixed login endpoint
s abcdefg actually fixed login endpoint
Of course, I get reminded about f/fixup every now and then - think "golly, that will save a second or two" and promptly forget.I know you can do this from within magit as well but I've never gotten into that workflow.
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.
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?