ubuntu环境下
#查看jdk的版本
fzw@onyx:~/workspace/3128_android_rom$ java -version
#切换jdk命令:
export JAVA_HOME=/usr/lib/jvm/jdk1.6;export PATH=/usr/lib/jvm/jdk1.6/bin:$PATH
#查看当前位于的git分支:
fzw@onyx:~/workspace/3128_android_rom$git br
#从一个或多个其他存储库中获取分支和/或标签(统称为“引用”)以及完成其历史所必需的对象。 远程跟踪分支已更新(Git术语叫做commit
),需要将这些更新取回本地,这时就要用到git fetch
命令。
fzw@onyx:~/workspace/3128_android_rom$git fetch origin tagus-gradle:tagus-gradle
#git remote -v | --verbose 列出详细信息,在每一个名字后面列出其远程url
fzw@onyx:~/workspace/3128_android_rom$git remote -v
#要添加一个新的远程仓库,可以指定一个简单的名字,以便将来引用,运行 git remote add [shortname] [url]:
$ git remote
origin
$ git remote add pb git://github.com/paulboone/ticgit.git
$ git remote -v
origin git://github.com/schacon/ticgit.git
pb git://github.com/paulboone/ticgit.git现在可以用字串 pb 指代对应的仓库地址了.比如说,要抓取所有 Paul 有的,但本地仓库没有的信息,可以运行 git fetch pb:
$ git fetch pb
#编译安卓源码步骤:
#查看jdk的版本
fzw@onyx:~/workspace/3128_android_rom$ java -version
#source源码
fzw@onyx:~/workspace/3128_android_rom$ source build/envsetup.sh
#lunch,选择编译的设备
fzw@onyx:~/workspace/3128_android_rom$ lunch
:chance the device what you want.
Which would you like? [aosp_arm-eng] C68-eng
#完成编译
#ubuntu远程同步文件到当前目录
rsync -avh [email protected]:/etc/shadowsocks.json ./
#开启shadowsocks 服务,有助于提高pull速度,每打开一个terminal都需要操作指令
fzw@onyx:~$ sudo sslocal -c shadowsocks.json -d start
#到达 .sh文件,远程同步文件过来
fzw@onyx:~$ cd .ssh/
fzw@onyx:~/.ssh$ ls
id_rsa id_rsa.pub known_hosts
fzw@onyx:~/.ssh$ rsync -avh [email protected]:/home/wangxu/.ssh/config ./
#查看.gitconfig
fzw@onyx:~$ vi .gitconfig
#重启shadowsocks服务
fzw@onyx:~$ sudo sslocal -c shadowsocks.json -d restart
#查看分支
fzw@onyx:~/workspace/3128_android_rom/apps$ git br
* dev
#查看分支详细信息
fzw@onyx:~/workspace/3128_android_rom/apps$ git br -a
* dev
remotes/origin/HEAD -> origin/dev
remotes/origin/dev
remotes/origin/master
remotes/origin/release-1.8.3-mc
#远程跟踪分支,有更新则同时本地更新
fzw@onyx:~/workspace/3128_android_rom/apps$ git fetch origin tagus-gradle:tagus-gradle
fzw@onyx:~/workspace/3128_android_rom/apps$ git br
* dev
tagus-gradle
fzw@onyx:~/workspace/3128_android_rom/apps$ ls
#查看 .gitmodules
fzw@onyx:~/workspace/3128_android_rom/apps$ cat .gitmodules
fzw@onyx:~/workspace/3128_android_rom/apps$ cd FBReaderJ/
fzw@onyx:~/workspace/3128_android_rom/apps/FBReaderJ$ git br
* dev
fzw@onyx:~/workspace/3128_android_rom/apps/FBReaderJ$ git st
On branch dev
Your branch is up-to-date with 'origin/dev'.
fzw@onyx:~/workspace/3128_android_rom/apps/FBReaderJ$ cd ..
fzw@onyx:~/workspace/3128_android_rom/apps$ git remote -v
origin [email protected]:onyx-intl/android.git (fetch)
origin [email protected]:onyx-intl/android.git (push)
fzw@onyx:~/workspace/3128_android_rom/apps$ git sub
submodule subtree
#查看当前分支的子模块
fzw@onyx:~/workspace/3128_android_rom/apps$ git submodule foreach git br
Entering 'FBReaderJ'
* dev
#来取更新当前分支的子模块
fzw@onyx:~/mnt/workspace/3128_android_rom$ git submodule foreach git pull
fzw@onyx:~/workspace/3128_android_rom$ cat .gitmodules
[submodule "bootable"]
path = bootable
url = [email protected]:onyx-intl/3128_bootable.git
fzw@onyx:~/workspace/3128_android_rom/frameworks/base/framework_helper$ git br
* dev
fzw@onyx:~/workspace/3128_android_rom/frameworks/base/framework_helper$ git remote -v
origin [email protected]:/home/wangxu/work/3128_android_rom/frameworks/base/framework_helper (fetch)
origin [email protected]:/home/wangxu/work/3128_android_rom/frameworks/base/framework_helper (push)
fzw@onyx:~/workspace/3128_android_rom/frameworks/base/framework_helper$ cd ..
#
克隆一个包含子仓库的仓库目录,并不会clone下子仓库的文件,只是会克隆下.gitmodule描述文件,需要进一步克隆子仓库文件。
// 初始化本地配置文件
$ git submodule init
// 检出父仓库列出的commit
$ git submodule update
fzw@onyx:~/workspace/3128_android_rom/frameworks/base$ git submodule update --init
fzw@onyx:~/workspace/3128_android_rom/frameworks/base$ git submodule sync
fzw@onyx:~/workspace/3128_android_rom/frameworks/base$ cd framework_helper/
fzw@onyx:~/workspace/3128_android_rom/frameworks/base/framework_helper$ git br
* (detached from 2c35a78)
dev
fzw@onyx:~/workspace/3128_android_rom/frameworks/base/framework_helper$ git co dev
fzw@onyx:~/workspace/3128_android_rom/frameworks/base/framework_helper$ git pull origin dev
fzw@onyx:~/workspace/3128_android_rom/apps$ git submodule foreach git br
fzw@onyx:~/workspace/3128_android_rom/apps$ git submodule foreach git remote -vEntering 'FBReaderJ'
origin [email protected]:onyx-intl/FBReaderJ.git (fetch)
origin [email protected]:onyx-intl/FBReaderJ.git (push)
fzw@onyx:~/workspace/3128_android_rom/apps$ git submodule foreach git fetch origin tagus-gradle:tagus-gradle
Entering 'FBReaderJ'
From github.com:onyx-intl/FBReaderJ
* [new branch] tagus-gradle -> tagus-gradle
fzw@onyx:~/workspace/3128_android_rom/apps$ git submodule foreach git co tagus-gradle
Entering 'FBReaderJ'
Switched to branch 'tagus-gradle'
Entering 'OnyxAndroidData'
fzw@onyx:~/workspace/3128_android_rom/apps$ git submodule foreach git br
Entering 'FBReaderJ'
dev
* tagus-gradle
fzw@onyx:~/workspace/3128_android_rom$ git fetch origin tagus-gradle:tagus-gradle
fzw@onyx:~/workspace/3128_android_rom$ git submodule sync
fzw@onyx:~/workspace/3128_android_rom/apps$ git remote -v
origin [email protected]:onyx-intl/android.git (fetch)
origin [email protected]:onyx-intl/android.git (push)
fzw@onyx:~/workspace/3128_android_rom/apps$ git fetch origin tagus-gradle:tagus-gradle
fzw@onyx:~/workspace/3128_android_rom/apps$ git bre
git: 'bre' is not a git command. See 'git --help'.
Did you mean one of these?
br
grep
rb
fzw@onyx:~/workspace/3128_android_rom/apps$ git br -a
fzw@onyx:~/workspace/3128_android_rom/apps$ git co tagus-gradle
M android_bookshop
Switched to branch 'tagus-gradle'
fzw@onyx:~/workspace/3128_android_rom/apps$ git br
=>pull code from git
->start shadowsocks service
fzw@onyx:~/workspace/3128_android_rom/apps$ sudo sslocal -c ../../../shadowsocks.json -d start
fzw@onyx:~/workspace/3128_android_rom/apps$ git submodule foreach git pull origin tagus-gradle
fzw@onyx:~/workspace/3128_android_rom/apps$ git pull origin tagus-gradle
fzw@onyx:~/workspace/3128_android_rom/apps$ git st
fzw@onyx:~/workspace/3288_android_rom/apps$ git submodule foreach git br
fzw@onyx:~/mnt/workspace$ git clone ../../workspace/3128_android_rom/apps 3128_android_rom/apps
fzw@onyx:~/mnt/workspace$ git remote -v
fzw@onyx:~/mnt/workspace/3128_android_rom$ git remote rm origin
fzw@onyx:~/mnt/workspace/3128_android_rom$ git remote add origin [email protected]:onyx-intl/3128_android_rom.git
fzw@onyx:~/mnt/workspace/3128_android_rom$ git submodule update --inte
fzw@onyx:~/mnt/workspace/3128_android_rom$ git submodule sync
#切换到dev分之
fzw@onyx:~/mnt/workspace/3128_android_rom$ git submodule foreach git co dev
fzw@onyx:~/mnt/workspace/3128_android_rom$ rsync -avh [email protected]:/home/wangxu/work/3288_android_rom/switch_branch.sh ./
fzw@onyx:~/workspace/3288_android_rom/apps$ adb remount
remount succeeded
fzw@onyx:~/workspace/3288_android_rom/apps$ adb shell
pp/ContentBrowser-release.apk <
root@Tagus_C68:/ # rm -r data/data/co
root@Tagus_C68:/ # rm -r data/data/com.onyx
root@Tagus_C68:/ # sync
root@Tagus_C68:/ # reboot
fzw@onyx:~/workspace/3288_android_rom/apps$ git co tagus-gradle
fzw@onyx:~/workspace/3288_android_rom/apps$ git submodule foreach git co tagus-gradle
fzw@onyx:~/workspace/3288_android_rom/apps$ git submodule foreach git br
->