Suppose my repository has two files, f1
and f2
, lines of each of which have been changed by multiple different commits. Now suppose my head commit, c3, changes line L_1_1 through L_1_2 of f1
and L_2_1 through L_2_2 of f2
, which were last altered in commits c1 and c2 respectively. For simplicity, let's assume each complete range of lines was altered in its entirety by its corresponding commit.
Now, I want to break this commit up into two separate changes, and apply each of them as a fixup to c1 and c2, so that they each get the changes I made to the relevant files in c3, at the point where the relevant lines were last changed rather than in a separate commit.
Naturally, I can do this manually: A soft reset to c3~, committing each of the files separately, and rebasing with editing the todo-list to correspond to the fixups I want. But this is a bit cumbersome, especially if it's not just the case of 2 files, but a lot more.
How can I affect this change more conveniently? (If it's at all possible.)
Notes:
- Naturally, I want to be able to do this not just for 2 files, but for many files.
- c3, c2 and c1 are not consecutive commits, nor the only commits. c3 is the head, that's all you can assume.