I need to modify a commit near the very beginning of my repository's history. Since that commit there have been probably hundreds of branches, merges, and merge conflicts.
I tried using interactive rebase with the --preserve-merges option, but I still get hundreds of conflict errors akin to "CONFLICT (content): Merge conflict in Foobar.cpp". Re-resolving them again manually is hugely impractical if not impossible.
I've heard of the 'rerere' feature, but only just now, so I haven't had it enabled.
Rerere will not help you here.
You are looking for
git filter-branch
. Depending on your change, you may be able use the index-filter which will be faster than the tree filter. You will alter all of your subsequent SHA-1s by doing this.Make sure to include the
--all
parameter so all of the references get updated. This is going to ruin any repo that uses this repo as a submodule as the SHA-1s will be referencing non-existent ones. You will need to do some more scripting to fix that.Also, if anyone you work with had any unpushed commits, they will have to
git rebase --onto
their outstanding work onto the new place in the history.In the coming years, we will hopefully see more support for performing such shenanigans - especially when submodules are involved.