1. Abstract
My ultimate goal is to bring some Client's changes done on a Client's branch in the linux-kernel repo to another linux-kernel repository, given the fact that both have a common base tag (e.g. v4.2, from which the Client's branch has been initially created).
For that I am trying to create a stack of patches representing the diff between the base and the head of the Client's branch. During this first step, I am using git format-patch
. The second step is applying those patches in the second repo using git am
.
git diff
and GNU diff
are not of interest to me, as I don't want to lose the commit metadata (author, message, etc).
2. Demo setup
I have created a simple git commit flow to exemplify the problem. The following graphs depict the branch setup of this demo repo:
3. Steps to reproduce the issue
$ git status
On branch master Your branch is up-to-date with origin/master. nothing to commit, working directory clean.
$ git format-patch BASE
0001-commit-2-br1.patch
$ git checkout BASE
HEAD is now at 65772fd... commit 3-master
$ git apply 0001-commit-2-br1.patch
error: patch failed: file:1 error: file: patch does not apply
4. Additional info & Questions
git diff BASE f316460 > my.patch
works! However, as stated in the Abstract, this is not a solution for me.I believe
git format-patch
is just not smart enough in the multiple branch setup. Have anyone run into the same problems?Are there any methods to achieve the same goal without
git format-patch
?