linux针对kernel协作开发形式写的scm工具,学习一下,将来想参与kernel开发有用
文章里用到的连接有:
http://www.bitsun.com/documents/gittutorcn.htm
http://www.ibm.com/developerworks/cn/linux/l-git/index.html
http://linux.yyz.us/git-howto.html



http://www.bitsun.com/documents/gittutorcn.htm
介绍了git的常用用法,不做scm的话常用的应该有
git-init-db
git-add
git-status
git-commit -a -m "...."
git-commit -m "...." -i filename

git-branch branchname         new branch
git-branch                    list branch
git-checkout branchname       checkout
git-branch -D branchname      delete branch

git-show-branch             
git-diff
git-whatchanged               history

还找到一个英文的快速入门
http://linux.yyz.us/git-howto.html
短小精悍,不错

Kernel Hackers' Guide to git


Getting Started

Installing git

git requires bootstrapping, since you must have git installed in order to check out git.git (git repository), and linux-2.6.git (kernel repository). You may find that your distribution already provides a usable version of git. If so, try that first.

  • Fedora Core 3 and later: git-core package is in Fedora Extras

    yum install git-core

If your distro doesn't have a package already, you should start by downloading a daily snapshot of the git source code.

Download the latest stable release from: http://www.kernel.org/pub/software/scm/git/.

tarball build-deps: zlib, libcurl, libcrypto (openssl)

install tarball:

unpack && make && sudo make prefix=/usr/local install

After reading the rest of this document, come back and update your copy of git to the latest: git://git.kernel.org/pub/scm/git/git.git

Download a linux kernel tree for the very first time

$ git-clone git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git linux-2.6

NOTE: The kernel tree is very large. This constitutes downloading several hundred megabytes of data.


Basic Tasks

Update local kernel tree to latest 2.6.x upstream ("fast-forward merge")

$ cd linux-2.6
$ git pull git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux-2.6.git

Undo all local modifications:

$ git checkout -f

Check in your own modifications (e.g. do some hacking, or apply a patch)

# go to repository
$ cd linux-2.6

# make some modifications
$ vi drivers/net/sk98lin/skdim.c

# NOTE: Run git-add and git-rm if adding or removing files.

# check in all modifications
$ git commit -a

List all changes in working dir, in diff format.

Display changes since last git-update-index:

$ git diff

Display changes since last commit:

$ git diff HEAD

Obtain summary of all changes in working dir

$ git status

List all changesets

$ git log

List all changesets belonging to a specific file

(in this case, net/ieee80211/ieee80211_module.c)
$ git-whatchanged net/ieee80211/ieee80211_module.c

Branches

List all branches

$ git branch

Make desired branch current in working directory

$ git checkout $branch

Create a new branch, and make it current

$ git checkout -b my-new-branch-name master

Examine which branch is current

$ git branch

(the branch with the asterisk '*' beside it is current)

Obtain a diff between current branch, and master branch

In most trees with branches, .git/refs/heads/master contains the current 'vanilla' upstream tree, for easy diffing and merging. (in trees without branches, 'master' simply contains your latest changes)

$ git diff master..HEAD

(this is equivalent to git diff HEAD, when used with HEAD branch)

Obtain a list of changes between current branch, and master branch

$ git log master..HEAD

(this is equivalent to git log, when used with HEAD branch)

or rather than full changeset descriptions, obtain a one-line summary of each changes:
$ git log master..HEAD | git shortlog

Merge changes from one branch into another

Let us suppose that you do work on branch A and branch B, and after work on those two branches is complete, you merge the work into mainline branch M.
$ git checkout M	# switch to branch M
$ git pull . A # merge A into M
$ git pull . B # merge B into M

Misc. Debris

Apply all patches in a Berkeley mbox-format file

First, make sure that the tools subdirectory of the git-core repository is in your PATH.

$ cd my-kernel-tree-2.6
$ git-applymbox /path/to/mbox /path/to/signoff.txt

The file /path/to/mbox is a Berkeley mbox file, containing one or more patches to be committed to the git repository. The optional file /path/to/signoff.txt is the text file that is appended to each changeset description. For the Linux kernel, this typically includes the

Signed-off-by: Your Name <your@email.com>

line that is common to almost all kernel submissions.

Don't forget to download tags from time to time.

git pull only downloads sha1-indexed object data, and the requested remote head. This misses updates to the .git/refs/tags/ and .git/refs/heads/ directories. For tags, run git pull --tags.