Revision 37 as of 2008-07-08 04:25:01

Clear message


Git is the new SCM used by the Linux kernel developers. Ubuntu has adopted this tool for our own Linux kernel source code so that we can interact better with the community and the other kernel developers.

Where is it?

Current GIT Trees

  • intrepid: git://
  • hardy: git://
  • gutsy: git://
  • feisty: git://
  • edgy: git://
  • dapper: git://

(actually there are a few more and of special note are the -updates git trees. To find out what else is available try browsing and searching for ubuntu)

Getting GIT

To obtain the git binaries, simply install the git-core package from dapper, e.g.:

sudo apt-get install git-core

Note that the git package is an entirely different tool which will not do what you want.

Getting the Ubuntu Linux kernel repo

The Ubuntu Linux kernel git repository is located at git://<release>.git. To download a local copy of the repo, use this command:

  git clone git:// ubuntu-intrepid

This will take some time depending on your connection. There's around 220 MiB of data to download currently (and this always increases).

Once this is complete, you can keep your tree up-to-date by running this command:

  git pull

** Warning ** During development, the kernel git repository is being constantly rebased against Linus' tree. IOW, Ubuntu specific changes are not being merged, but rather popped off, the tree rebased and then pushed on to keep them on top. This will cause git pull to fail. Hence, there are two ways to track the kernel git tree, depending on whether you have local changes or not.

No Local Changes

  git fetch -f origin
  git checkout origin
  git branch -f master origin
  git checkout master

Preserve Local Changes

  # Save away local commits
  git rev-list --reverse origin..HEAD > local-commits
  git branch new-head origin
  git checkout new-head
  # This will stop on first error. Cleaning up failures is an excercize for the user
  for cmt in `cat local-commits`; do git-cherry-pick $cmt || break; done
  git branch -f master new-head
  git checkout master
  git branch -D new-head

Pushing changes to the main repo

Since the main repo is not publicly writable, the primary means for sending patches to the kernel team is using git-format-patch. The output from this command can then be sent to the [ kernel-team] mailing list.

Alternatively, if you have a publicly available git repository for which changes can be pulled from, you can use git-request-pull to generate an email message to send to the [ kernel-team] mailing list.

Commit templates

In debian/commit-templates/ there are several templates that must be used when commiting changes that you expect to be integrated with the Ubuntu kernel repo. The commit templates contain comments for how to fill out the required information. Also note that all commits must have a Signed-off-by line (the "-s" option to git-commit). A typical git-commit command will look like:

  git-commit -s -F debian/commit-templates/patch -e

Note that the -e (edit) option must follow the -F option, else git will not let you edit the commit-template before committing.

An example commit log will look like such:

  UBUNTU: scsi: My cool change to the scsi subsystem

  UpstreamStatus: Merged with 2.6.15-rc3

  My cool change to the scsi subsystem makes scsi transfers increase
  magically to 124GiB/sec.

  Signed-off-by: Joe Cool Hacker <>

Patch acceptance criteria

In general, Ubuntu will apply the same criteria applicable to upstream kernel. Here is a checklist of reading and tools related to posting kernel patches:

  • <kernel-directory>/Documentation/SubmittingPatches

  • <kernel-directory>/scripts/

  • <kernel-directory>/scripts/cleanpatch

  • <kernel-directory>/scripts/cleanfile

  • <kernel-directory>/scripts/Lindent

If you are creating a new file, it is helpful to run it through cleanfile and/or Linent before creating a patchBR If you have generated a patch, it helps running it through and cleanpatch if necessaryBR Also, using the commit template described above is a good idea for Ubuntu-specific patches

Developers with access to

The kernel team has a git repo located on (AKA in /srv/

You can, if you want, create a clone for yourself in your directory, and just have your changes pulled when ready.

Suggested way to do this:

git-clone -l -n -s /srv/
vi ubuntu-intrepid/.git/description
( give it a descriptive name )
mv ubuntu-intrepid/.git /srv/<user>/my-git-tree.git

You can now push your changes to this tree via ssh. Note the -l -n -s options do a few special things, mainly making your repo share objects with ours (saves space).

Now you need to run git-update-server-info in your tree so that it is available over http transport

cd /srv/<user>/my-git-tree.git
chmod +x /srv/<user>/my-git-tree.git/hooks/post-commit

To work on your branch, now clone to your local machine from the same origin tree (not the tree you just created on zinc -- this is only for pushing to):

git clone git:// my-tree
*do work*
git send-pack<user>/my-git-tree.git master

Suggested method for keeping this tree synced with the ubuntu tree, instead of git-pull, is to do:

cd my-tree
git-fetch origin
git-rebase origin

This will keep your changes on top of the original tree (as opposed to being merged). This is also a good idea because during development (e.g. while following the upstream git repo), we frequently rebase to linux-2.6.git upstream, so the HEAD is not always suitable for pull/merge.

More information

Please read the documentation included with the git-core package for more details on git commands. A tutorial is also available at