1. 搭建 git 服务器

git服务器有很多,比如使用android 提供的 gerrit 服务器,安装方法参见gerrit 环境搭建

2 同步远程库

$ mkdir ~/review_site/git/google$ cd ~/review_site/git/google$ repo init -u https://android.googlesource.com/platform/manifest$ head -n 12 .repo/manifest.xml

<?xml version="1.0" encoding="UTF-8"?>

<manifest> <remote name="aosp" fetch="https://android.googlesource.com/" review="https://android-review.googlesource.com/" /> <default revision="master" remote="aosp" sync-j="4" /> <project path="build" name="platform/build" groups="pdk" > <copyfile src="core/root.mk" dest="Makefile" />$ repo sync
直接同步(sync)会出现”代码库不存在“错误,是因为使用的repo不支持manifest相对路径。 如果从http://android.git.kernel.org/repo 下载 repo 就会有这个问题,建议从https://chromium.googlesource.com/external/repo 下载 需要参照上面修改.repo/manifest.xml 文件中的 fetch 节点,然后再同步。

3 调整代码库

如果需要对 android 进行二次开发,最好创建自己的分支,方法如下:

3.1 所有项目增加分支

直接在代码库中执行
$ repo forall -c git branch --no-track mybranch master

3.2 manifest 项目增加相应分支

  • 首先,在本地同步manifest 库
$ cd ~$ git clone ~/review/git/platform/manifest.git
  • 其次,增加新分支,并对 default.xml 作相应调整
$ cd ~/manifest$ git checkout -b mybranch origin/master$ head -12 defalut.xml<?xml version="1.0" encoding="UTF-8"?><manifest>  <remote  name="myserver"           fetch=".." />  <default revision="mybranch "           remote="myserver"           sync-j="1" />  <project path="build" name="platform/build">    <copyfile src="core/root.mk" dest="Makefile" />  </project>
  • 推送到代码库中

$ git add defalut.xml$ git commit -m "modify manifest"$ git push origin mybranch:mybranch

更多相关文章

  1. android源代码下载
  2. android 单选框
  3. Android(安卓)zxing change orientation to portrait
  4. Android(安卓)SyncManager 实现
  5. How To Open An URL In Android’s Web Browser
  6. Android也有beacon了
  7. 利用Handler来更新android的UI
  8. 系出名门Android(8) - 控件(View)之TextSwitcher, Gallery, Imag
  9. Android(安卓)旋转屏幕捕获当前屏幕的状态

随机推荐

  1. android studio 使用getActionBar返回NUL
  2. Android优化技巧
  3. Android汉字转换成拼音
  4. Android中如何一次性finish掉以前打开的
  5. Android仿QQ空间
  6. Ubuntu 14 配置Android(安卓)Studio的快
  7. Android(安卓)TTS实现简单阅读器(一)
  8. 自定义Android Progress Bar的颜色
  9. android app中的给应用评分
  10. Android 获取NavigationBar高度