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 184.108.40.206 patch this must be applied to the first version in this case 2.6.38, not any of its subversion, eg. 220.127.116.11 or 18.104.22.168. 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 22.214.171.124
$ git checkout 126.96.36.199
Issue patch command with (also my favourite bzip2 - patch command style)
$ bzip2 -dc /path_to/patch-188.8.131.52.bz2 | patch -p1
$ git commit -m 'Linux 184.108.40.206'
Now we have 220.127.116.11 version at 18.104.22.168 branch, then lets create 22.214.171.124 branch for 126.96.36.199 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 188.8.131.52
$ bzip2 -dc /path_to/patch-184.108.40.206.bz2 | patch -p1
$ git commit -m 'Linux 220.127.116.11'
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 18.104.22.168 to 22.214.171.124, it is impossible to just merging 126.96.36.199 and 188.8.131.52 branch, so we must result a diff file from version 184.108.40.206 to 220.127.116.11, those commands simply do the magic.
$ git checkout 18.104.22.168
$ mkdir /path_to/22.214.171.124
$ cp -r . /path_to/126.96.36.199/
$ git checkout 188.8.131.52
$ diff -ur . /patch_to/184.108.40.206 | bzip2 -zc > /path_to/patch-inc-220.127.116.11.bz2
The 18.104.22.168 to 22.214.171.124 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-126.96.36.199.bz2 | patch -p1
$ git commit -m 'Linux-188.8.131.52'
$ 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.