Git常用命令

第一步:本机上安装软件

-----------------------------------

(1)sudo apt-get install git-core curl


第二步,向git表明自己的身份

--------------------------

$ git config --global user.name "Your Name Comes Here"
$ git config --global user.email you@example.com
git-config –list 查看配置情况
比如:
$ git config --global user.name “hejian"
$ git config --global user.email hejian@archermind.com



第三步:从中心服务器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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值