I am currently working on reordering, squashing and changing some stuff in a git branch which has a lot of pending commits (currently around 300) that needs to be merged. I am facing difficulties working on it simultaneously.
Consider that the branch currently has commits A-B-C-D-E-F-G-...
and so on, where A is the oldest commit that is not merged to the target branch. Now I make some changes, to say commit D (squash some bug to it, reorder it, etc.). Now my branch would look like A-B-C-D1-E1-F1-G1-H1-I1-...
and so on (the commit hash changes for D and any commits newer than D).
Suppose at the same time another person does some other change to say, commit H. Now on his local branch, it would seem like A-B-C-D-E-F-G-H2-I2-J2-K2-...
and so on.
Now, either of us pushed our changes to the remote branch (suppose I do it). Now on remote branch, the commits are A-B-C-D1-E1-F1-G1-H1-I1-...
and so on, while on person B's local branch, it is A-B-C-D-E-F-G-H2-I2-J2-K2-...
and so on.
My main issue is, how can person B rebase his local branch in a manner that would allow him to pull the changes pushed to the remote branch, while keeping his changes which he made in the local branch (something like A-B-C-D1-E1-F1-H3-I3-J3-...
and so on. I am okay with some merge conflicts arising, but don't want to lose changes made by either person A or person B). Can someone suggest a good approach to tackle this problem?