I have two branches which have very little similar history, but are related to each other.
I want the changes between those two in one git commit.
files have been deleted and created between those patches and I want the patch to reflect that
i.e.: the following stuff will not work:
git diff branch_a branch_b -- > patchfile
git checkout branch_b
git apply patchfile # deletes and adds are ignored
git commit # we miss the deletes
If you have two branches:
has-changes
needs-changes
And you want to move the changes from
has-changes
ontoneeds-changes
, then do the following:It all comes down to a
git reset --soft branch_b
on top of a temp branch based on branch_a, and the result committed back to branch_b.This is a step-by-step walking through the process:
A simple way to do it is:
git branch tmp branch_a && git checkout tmp
)git reset --soft branch_b
git commit
that commit must have all the diff