第一步:本机上安装软件
-----------------------------------
(1)sudo apt-get install git-core curl
第二步,向git表明自己的身份
--------------------------
$ git config --global user.name "Your Name Comes Here"
$ git config --global user.email
[email protected]
git-config –list 查看配置情况
比如:
$ git config --global user.name “hejian"
$ git config --global user.email
[email protected]
第三步:从中心服务器192.168.12.132上的 Git Repository 取得资料
在个人的工作目录下,做下面操作,即可下载代码:
-------------------------------
mkdir roewe_android
cd roewe_android
git clone git://192.168.12.132/roewe_android.git/tools/repo.git tools/repo.git
--这一步是主要是为了获取repo文件,如果自己已经有这个文件,这一步可以跳过。
./tools/repo.git/repo init -u git://192.168.12.132/roewe_android.git/platform/manifest.git -b master
./tools/repo.git/repo sync
./tools/repo.git/repo start master --all
--这个master是一个分支,如果不存在,需要自己创建一个
Push update to git server
#############################################################################
2。git 源码管理
常用命令:
1。 开始工作时需要从服务器更新源码
cd roewe_android
./tools/repo.git/repo sync (更新所有git仓库)
./tools/repo.git/repo start master--all
2。 开始在各个应用的相关目录下工作
cd packages/app/Launcher
git branch mybranch (创建分支)
git checkout mybranch (切换分支)
。。。。。(修改源码)
git status (查看改动文件)
git diff <fileName> (查看详细改动)
git checkout <fileName> (相当于svn revert file)
。。。。。 (编译,验证代码)
git add . (注意:在源码修改未完成时,请不要使用git add)
git commit -m "xxx"
3. 下班前需要将改动的代码上传到服务器
cd packages/app/Launcher
git checkout master
git merge mybranch
git branch -D mybranch
git push (提交代码到服务器)
4. 第二天下载daily build结果进行验证
下面是一个上传本地项目到git服务器上的AndroidRDP目录下的实例:
请使用一下步骤将RDP的程序放到AndroidRDP下,需要附件的repo文件(shell文件):
1. 建立目录apps: mkdir apps
2. 进入目录apps: cd apps
3. 下载服务器中的仓库到本地:
repo init -u git://192.168.11.206/git/apps/platform/manifest.git
repo sync
repo start --all master
4. 将RDP程序的文件放到AndroidRDP中
5. 向服务器提交文件:
git add .
git commit -m "initial commit"
git push