I have an existing repository that has root R, then a few dozens of commits including multiple merges, up to X, and then linear history up to Y. I'd like to squash everything from R to X into a single commit and force push it. How can I do it without a lot of effort involving re-resolving merges?
Alternatively, this problem could be phrased as changing the root commit from R to X and cutting off the graph before X.
Here is an illustration simplifying the commit graph:
R ---- I want to squash from here... | A |\ B C | | D E | |\ F G H | |/ I J |\ \ K L M |/ | N / |/ O | X ---- to here. | P | Q | Y Squashing everything with regular rebase would require re-resolving multiple merge commits. I am aware of git rerere, but I do not know how to use it in this situtation. It was not enabled when commiting all that.