Alex Alex - 5 months ago 59
Git Question

git create commit from diff between two branches

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

Answer

A simple way to do it is:

- create and checkout branch tmp at branch_a
- reset --soft to branch_b
- commit

that commit must have all the diff