Notes on git
These are my notes on git — the stupid content tracker. I am using git mostly to keep local Linux kernel sources. Here are the tasks that I normally need.
Checkout
To get Linus' tree:
git clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git linux-2.6
To get another fork and use Linus' tree as a baseline to reduce traffic:
git clone --reference linux-2.6 git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-2.6.18.y linux-2.6.18.y
Update
To get the latest changes from the kernel maintainers:
git pull git fetch --tags
To revert to the clean copy:
git reset --hard HEAD git clean
List tags and branches
git tag -l git branch
Local branches
Create local branch from tag. Useful to make a release:
git checkout -b <branch> <tag>
To switch between branches:
git checkout <branch>
To delete a branch
git branch -d <branch>
Release
Creating a tarball
git archive --format=tar --prefix=linux-2.6.20/ v2.6.20 | gzip >linux-2.6.20.tar.gz
Releasing to a directory
git archive --format=tar --prefix=linux-2.6.20/ v2.6.20 | (cd /usr/src && tar xf -)
Diffing
Create diff between tags:
git diff v2.6.18.1..v2.6.18.2 > patch.diff