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