This article provides a brief tutorial on using git to access the projects hosted on this server and obtain source code from them. The git developers also provide some more general documentation which cover other features such as maintianing your own changes in git.
Throughout this tutorial the ALSA SoC project will be used as an example. To use other repositories replace git://opensource.wolfsonmicro.com/linux-2.6-asoc with the URL for the appropriate repository in the commands below.
Cloning a repository
git is a distributed revision control system. This means that as well as downloading the source code for the revision it is working with git also needs to download other data required to work with the project off-line. All of the other git commands require you to have first cloned the repository you wish to work with. This process is called cloning and is done like this:
git clone git://opensource.wolfsonmicro.com/linux-2.6-asoc linux-2.6-asoc
This command will create a new directory called linux-2.6-asoc in the current directory with a copy of the source and all the information git needs to work with it. Once this download is complete all work can then be done without internet access.
All other commands in this tutorial will assume you are in the directory created by this command.
To check out a copy of the development branch in your local clone this command is used:
git checkout --track -b wolfson-dev origin/dev
This will create a branch wolfson-dev based on the dev branch on the Wolfson server (git calls the server you did the original clone from origin by default). You now have a copy of the source code locally which you can browse and edit as normal.
Generating a patch
To generate a patch from your checked out copy to a given version of the standard Linux kernel the git diff command can be used like this:
git diff v2.6.23
to generate a list of changes against version 2.6.23. Individual files or directories can be diffed by listing them on the command line like this:
git diff v2.6.23 sound/soc
To ask git to fetch updates from the Wolfson server run this command:
git fetch origin
This downloads the changes to your computer but does not modify any source code you have checked out. You can then copy the changes from the Wolfson dev branch into your current branch with this command:
git merge origin/dev
Replace dev with the name of another branch to merge that branch instead.