Using Git

LTSI uses the git source code management tool.

git is used for a large number of development projects, the most notable being the Linux kernel. There are a number of excellent git tutorials that are focused on Linux, such as these at kernel.org and from Jeff Garzik.

Aside from LTSI using a different url for our git tree, all of the commands should apply.

Basic Tasks in git

Get the LTSI source code

This will create a directory named "LTSI" in your home directory, and fetch the most up-to-date version of the source code.

$ git clone http://git.linuxfoundation.org/ltsi-kernel.git ~/LTSI

Update your local copy of the source code

Use this before you begin any new development, to get the latest updates.

$ cd ~/LTSI

$ git pull http://git.linuxfoundation.org/ltsi-kernel.git

Undo any changes you've made

This discards any changes you may have made to files within your local copy of the LTSI source code. Note that it only affects files tracked by git. It won't prune files.

$ cd ~/LTSI

$ git checkout -f

Finding your changes

This shows changes to files that are tracked in git since the last time you ran "git add" or "git rm". Note that untracked files will not be listed here.

$ cd ~/LTSI

$ git diff

This shows any changes you've made since the last commit.

$ cd ~/LTSI

$ git diff HEAD

This gives a brief overview of how the directory differs from the last commit. It will list new files that are untracked, and any changes waiting to be committed.

$ cd ~/LTSI

$ git status

Finding out who changed what

This returns the changeset of all commits to the git tree. If something stopped working after your last git pull, this is a good place to look for clues as to what changed.

$ cd ~/LTSI

$ git log

You can also look at the changelog for a particular file.

$ cd ~/LTSI

$ git log path/to/file

Other useful options for git log include '-p', which shows the diff source code, and '--stat', which gives detailed information on insertions, deletions, and modifications per file. (You may have to install the diffstat package separately.)