Git

1、Git的安装
在Ubuntu 8.04上安装git只要设定了正确的更新源,然后使用apt-get就可以了,有什么依赖问题,就让它自己解决吧。其中curl是一个利用URL语法在命令行下工作的文件传输工具,会在后面安装Repo的时候用到。
sudo apt-get install git-core curl

2、安装Repo
首先确保在当前用户的主目录下创建一个/bin目录(如果没有的话),然后把它(~/bin)加到PATH环境变量中
接下来通过curl来下载Repo脚本,保存到~/bin/repo文件中
curl http://android.git.kernel.org/repo >~/bin/repo

别忘了给repo可执行权限
chmod a+x ~/bin/repo
scd

3、初始化版本库
如果是想把Android当前主线上最新版本的所有的sourcecode拿下来,我们需要repo的帮助。
先建立一个目录,比如~/android,进去以后用repo init命令即可。
repo init -u git://android.git.kernel.org/platform/manifest.git
最后会看到 repo initialized in /android这样的提示,就说明本地的版本库已经初始化完毕。

4. 下载Android代码
运行如下命令 $ repo sync

5. du -sk 或du -sm 可看文件夹容量大小


Git下载android linux kernel源码(含git其他常用命令)

1. mkdir android_kernel 
2. cd android_kernel 
3. git clone git://android.git.kernel.org/kernel/common.git (下载默认版本内核源码)

下面是git常用的命令示例:
4. cd common
5. git branch(查看当前分支,结果为android-2.6.27)
6. git branch -r(显示远程branch列表)
   origin/HEAD
origin/android-2.6.25
origin/android-2.6.27
origin/android-2.6.29
origin/android-2.6.32
origin/android-goldfish-2.6.27
origin/android-goldfish-2.6.29

7. git tag (显示tag列表,下面截取一部分结果)

8. git checkout -b android-2.6.29 v2.6.29 (检出一个新branch android-2.6.29)
   git checkout -b android-2.6.25 v2.6.25 (检出一个新branch android-2.6.25)
9. git branch -d android-2.6.27 (删除branch android-2.6.27)
10. git checkout android-2.6.29 (切换至brach android-2.6.29)
11. git format-patch android-2.6.25..android-2.6.29 (会生成4万个patch)
 


id 博主 = [[KILONET.CNBLOGS.COM alloc] initWithValue:@"天堂向右,我依然向左"

              网名:@"老舟"

              兴趣:@"影音,阅读"

              动态:@"系统架构设计,Android通信模块开发"

              网址:@"http://kilonet.cnblogs.com"
              签名:@"--------------------------------------------------

                              Stay Hungry , Stay Foolish

                              求  知  若  渴,处  事  若  愚

                          --------------------------------------------------"

              ];         // Never Release

原文地址:https://www.cnblogs.com/KiloNet/p/1804742.html