With interactive rebase (git -i rebase ...) one can edit commits anywhere in the current branch's lineage, thus "rewriting history".
A given commit, however, can belong to the lineages of multiple branches.
For example, suppose I have a repo with this branch structure:
A --- B --- C --- D --- F --- G branch_1* \ `-- H --- I --- J branch_2 \ `-- K branch_3 If the active branch is branch_1, and I use rebase -i to edit commit B, the resulting repo would look like this (at least until GC happens):
,-- b --- c --- d --- f --- g branch_1* / A --- B --- C --- D --- F --- G \ `-- H --- I --- J branch_2 \ `-- K branch_3 Note that the original B continues to be in the lineages of branch_2 and branch_1. Repeating the process for each of these branches, as tedious as that would be, would result in multiple redundant commits, and the original branch structure would be lost:
,-- b --- c --- d --- f --- g branch_1 / A --- B --- C --- D --- F --- G | \ | `-- H --- I --- J | \ | `-- K |\ | `-- b' -- c' -- h --- i --- j branch_2* \ `-- b'' - c'' - h' -- i' -- k branch_3* Note that b, b', and b'' are essentially equivalent commits. The same thing goes for c, c', and c'', h and h', and i and i'.
Is there a halfway convenient way to achieve something like this:
A --- b --- c --- d --- f --- g branch_1* \ `-- h --- i --- j branch_2 \ `-- k branch_3 ...where the modification to the B commit gets propagated through all the lineages it belongs to?
(I'd prefer a solution that also propagates the changes through to all the descendant stashes.)