4 ms·
I usually solve this by commiting my fixup in a dummy commit, then do a rebase -i HEAD~n where n is the number of commits I want to look back at. Then during th
by fla 3y ago
I usually solve this by commiting my fixup in a dummy commit, then do a rebase -i HEAD~n where n is the number of commits I want to look back at. Then during the rebase I just move my commit below the one that seem the most appropriate and mark it for squash. Execute the rebase. Done
- Seb-C 3y agoWow, I never realized that changing the order of commits in an interactive rebase was a legit operation. Thanks for the tip!
- shaftway 3y agoAnother way to handle this if you haven't made the change yet is to do a `git rebase -i head~4` (or however far back) and mark the place where the change needs to happen as "edit". Make your change, add the file, then `git rebase --continue`. If you've already made the change but haven't committed it, you can stash it before doing the rebase, then pop the stash while editing that commit.
- graton 3y agoIf you have `fzf` installed you might try this alias. frbi = "!f() { git rebase -i $(git log --pretty=oneline --color=always | fzf --ansi | cut -d ' ' -f1)^ ; }; f" I do: `git frbi` (which in my mind means Fzf ReBase Interactive) Then I can easily scroll up to the commit I want to start the rebase on.