from: http://blog.microsuncn.com/?p=2093
git fetch 从另一个repository中下载objects and refs, 这里用git fetch获取Android Kernel:
Android Kernel的git repository在 git://android.git.kernel.org/kernel/common.git
首先,先建立一个工作目录:
$ mkdir android-kernel-git
$ cd android-kernel-git
建立git环境:
$ git init
$ git remote add android git://android.git.kernel.org/kernel/common.git
获取android kernel
$ git fetch android
remote: Counting objects: 1637009, done.
remote: Compressing objects: 100% (272756/272756), done.
remote: Total 1637009 (delta 1360356), reused 1622966 (delta 1350661)
Receiving objects: 100% (1637009/1637009), 336.06 MiB | 203 KiB/s, done.
Resolving deltas: 100% (1360356/1360356), done.
From git://android.git.kernel.org/kernel/common
* [new branch] android-2.6.25 -> android/android-2.6.25
* [new branch] android-2.6.27 -> android/android-2.6.27
* [new branch] android-2.6.29 -> android/android-2.6.29
* [new branch] android-2.6.32 -> android/android-2.6.32
* [new branch] android-2.6.35 -> android/android-2.6.35
* [new branch] android-goldfish-2.6.27 -> android/android-goldfish-2.6.27
* [new branch] android-goldfish-2.6.29 -> android/android-goldfish-2.6.29
From git://android.git.kernel.org/kernel/common
* ………
* [new tag] v2.6.32 -> v2.6.32
* [new tag] v2.6.32-rc1 -> v2.6.32-rc1
* [new tag] v2.6.32-rc2 -> v2.6.32-rc2
* [new tag] v2.6.32-rc3 -> v2.6.32-rc3
* [new tag] v2.6.32-rc4 -> v2.6.32-rc4
* [new tag] v2.6.32-rc5 -> v2.6.32-rc5
* [new tag] v2.6.32-rc6 -> v2.6.32-rc6
* [new tag] v2.6.32-rc7 -> v2.6.32-rc7
* [new tag] v2.6.32-rc8 -> v2.6.32-rc8
查看当前有那些分支:
$ git branch -a
remotes/android/android-2.6.25
remotes/android/android-2.6.27
remotes/android/android-2.6.29
remotes/android/android-2.6.32
remotes/android/android-2.6.35
remotes/android/android-goldfish-2.6.27
remotes/android/android-goldfish-2.6.29
把2.6.35的分支checkout出来:
$ git checkout -b working remotes/android/android-2.6.35
$ git branch -a
* working
remotes/android/android-2.6.25
remotes/android/android-2.6.27
remotes/android/android-2.6.29
remotes/android/android-2.6.32
remotes/android/android-2.6.35
remotes/android/android-goldfish-2.6.27
remotes/android/android-goldfish-2.6.29