MTD GIT HOWTO

The MTD GIT trees are documented here and can be browsed through the gitweb interface at http://git.infradead.org/.

Users with accounts on git.infradead.org (aka bombadil.infradead.org) can create their own git trees which are publicly accessible. A cron job runs every five minutes, indexing the available trees in users' ~/public_git/ directories and making them available in gitweb.

When creating GIT trees with patches you intend to be pushed upstream, please try to ensure that we end up with as few merges as possible. Anything you commit should be on top of the development tree (see here), rather than against a clean tree from Linus. Avoid doing any merges of your own, unless absolutely necessary.

Please try to avoid cloning a full tree directly from git.infradead.org -- you'll be downloading many thousands of objects which are already present in the official upstream source tree. Save your disk space and our network bandwidth by using 'alternates' instead. This is what the '--reference' command in the examples below is for. It means that you keep only one copy of all the git objects which exist in the 'reference' or 'alternate' tree, rather than duplicating them.


General GIT reference documentation


Creating your own tree on git.infradead.org

Creating your own tree is simple. You create a public_git directory within your home directory, and ensure that it is world-readable:
$ ssh bombadil.infradead.org
$ mkdir ~/public_git
$ chmod og+rx ~ ~/public_git
Once you've done that, you can create trees in your public_git directory by cloning from the existing trees which are in /srv/git (or indeed from other users' trees):
$ cd ~/public_git
$ git clone -l -n -s --bare /srv/git/linux-mtd.git foo.git
$ echo 'this is my tree for playing with foobar' > foo.git/description

Your new tree will be immediately accessible to the public through the URL git://git.infradead.org/~user/foo.git.

Within five minutes of its creation, your tree should be visible through the gitweb interface too.

You can then make a local clone of your public tree (as shown below), make commits to it and push them back. For this, use the URL ssh://git.infradead.org/~/public_git/foo.git.

Note: The git dæmon exports each user's public_git directory as git://git.infradead.org/~user — just as httpd would export their public_html directory as http://bar.infradead.org/~user. So be aware that when using ssh:// URLs, you must specify the public_git part of the path, as shown in the example above.


Working with your GIT tree

Clone Linus' tree

If you don't already have a copy of Linus' tree locally, get one:
$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git linux

Clone MTD tree

Using Linus' tree as a reference for existing objects, clone the MTD tree:
$ git clone --reference linux git://git.infradead.org/linux-mtd.git linux-mtd

Clone your own tree

Now using the MTD tree as a reference for existing objects, clone your own tree from your public_git directory:
$ git clone --reference linux-mtd ssh://git.infradead.org/~/public_git/foo.git myfoo
Having cloned your tree, you can now commit to it using git-commit and push the results back with git-push.

Keeping branches in your own tree

In general, I would advise that you avoid branches; especially on the server — it's easy enough just to create new trees instead, and much less complicated to deal with.

However, it is useful to keep a 'branch' in your tree for each upstream repository that you pull from. The linux-mtd.git tree has such a branch called 'linus' which shows the last merge from Linus' master kernel tree, thus allowing operations like git-diff linus.. to work easily, and helping the the script which feeds the commits list to exclude commits which came from upstream repositories.

You may find it useful to keep similar 'linus' and 'mtd' branches in your own tree. This used to be relatively simple, but I don't actually know how to set up current versions of git to do it so I won't attempt to explain it here.

Valid XHTML 1.0! Valid CSS!