Let's say I have commit 1, 2 ... 10.000.000, and I want to fixup commit 8.000.000 to 1.000, e.g sha2 is merged into sha1, keeping sha1's commit message, and keeping all other commits in order, where sha1 and sha2 are very far from each other and very far from HEAD.
This question has been asked several times, but every time it is assumed that the commits are close to each other and close to HEAD and git rebase -i HEAD~5
can be used. I just don't see how that is manageable as the number of commits scale.
I am hoping for an answer along the lines of git rebase --fixup sha2 --onto sha1
Related questions:
- Squashing commits far apart in git history despite title, question and answer assumes commits are close to each other and close to HEAD.
- how to re-order commits in Git non-interactively asks to reorder non-interactively, but top answers uses interactive rebase, and other answer suggest writing a line for each commit between sha1 and sha2
- How do I run git rebase --interactive in non-interactive manner? asks about how to export rebase list to a file for later editing.
- Squash Git commits *non-interactively* with git rebase wants to squash all commits not shared between two branches. I want to squash/fixup 1 commit into 1 other commit, keeping all other commits the same.