I have a snapshot of the android kernel source code from a while ago, to which I have added some features. Now I have a newer version of the source published by manufacturer. How can I update my source without losing my changes? If i use
diff -Naur old/ new/ > new1.patch
"" then apply patch by
patch -p1 < new1.patch
I will lose modified code and extra files that were available in old source but if I use
diff -Naur new/ old/ > new2.patch
It preserves my modified code and extra files, but I don't know if the source is updated or not. Is there any solution for this? Perhaps using git rebase or merge? Thanks.
Do I understand correctly: you had a kernel version provided by your manufacturer, to which you made your own modifications?
Then you want to upgrade your kernel version, but still have your modification?
The most natural way is to work with branches and merges. For example, you could update your branch
master
according to the deliveries from your manufacturer, and maintain a branchmy_code_branch
(of course, you need a much better branch name than this) to which you merge upstream kernel updates.Then when an upgrade comes from your manufacturer, you update your master with:
and get:
Then merge the changes from your manufacturer, into your own branch:
to get:
If you don't need the local
master
branch, you could also stay onmy_branch
and pull directly:Note that you could also do the opposite: your code in
master
while maintaining a branchmanufacturer
that you'd keep up-to-date with the manufacturer.