Beside to clone the kernel development tree directly from its git repository, I want to create repository from a stable kernel and its patches, I will have commit for each subversion patch. The last stable kernel at this time is 2.6.38.
First download the 2.6.38 first release (not the subversion releases) named linux-2.6.38.tar.bz2, extract it with (my favourite bzip2 - tar style)
$ bzip2 -dc linux-2.6.38.tar.bz2 | tar xf -
Initialize git repository, add files and do initial commit.
$ cd linux-2.6.38
$ git init && git add .
$ git commit -m 'Linux 2.6.38'
Time to download the patches, please note that the kernel patch system is not a increment patch, this means when we got version 22.214.171.124 patch this must be applied to the first version in this case 2.6.38, not any of its subversion, eg. 126.96.36.199 or 188.8.131.52. At this time, I have these following patch files
After we got out desired patches, so now lets create another branch for patching purposes, still at our master branch.
$ git branch 2.6.38
$ git branch 184.108.40.206
$ git checkout 220.127.116.11
Issue patch command with (also my favourite bzip2 - patch command style)
$ bzip2 -dc /path_to/patch-18.104.22.168.bz2 | patch -p1
$ git commit -m 'Linux 22.214.171.124'
Now we have 126.96.36.199 version at 188.8.131.52 branch, then lets create 184.108.40.206 branch for 220.127.116.11 patch as well, remember that we must have first version to apply a patch, so create this branch based the first version branch.
$ git checkout 2.6.38
$ git branch 18.104.22.168
$ bzip2 -dc /path_to/patch-22.214.171.124.bz2 | patch -p1
$ git commit -m 'Linux 126.96.36.199'
Lets describe what we have in our repository, we already have 4 branches with its branch's name as its version, except for master branch, it has 2.6.38 version. I want to have each version has its commit on the master branch, but I don't have increment path for version 188.8.131.52 to 184.108.40.206, it is impossible to just merging 220.127.116.11 and 18.104.22.168 branch, so we must result a diff file from version 22.214.171.124 to 126.96.36.199, those commands simply do the magic.
$ git checkout 188.8.131.52
$ mkdir /path_to/184.108.40.206
$ cp -r . /path_to/220.127.116.11/
$ git checkout 18.104.22.168
$ diff -ur . /patch_to/22.214.171.124 | bzip2 -zc > /path_to/patch-inc-126.96.36.199.bz2
The 188.8.131.52 to 184.108.40.206 patch is now generated in bz2 format, this an increament patch, we can now apply this patch to the master branch.
$ git checkout master
$ bzip2 -dc /path_to/patch-inc-220.127.116.11.bz2 | patch -p1
$ git commit -m 'Linux-18.104.22.168'
$ git log
As you can see the master branch log is now have increment version for each commit, this will be helpfull if we want to trace patches for every subversion.