A simple way to make “the diff from branch_b..branch_a” into a commit is:
- create and checkout branch tmp at branch_a (
git branch tmp branch_a && git checkout tmp
) (orgit reset --hard branch_a
on an existing branch) git reset --soft branch_b
git commit
that commit will include all the diff between branch_b and branch_a.
This works because
1.
causes the files to reflect branch_a. This is the “end result” you want for the branch2.
“resets the head to branch_b” but “leaves all your changed files [i.e. branch_a head] as “Changes to be committed”, as gitstatus
would put it.” ←(git reset --soft
docs, with this example’s branches added)