Git操作手册2

获取远程库到本地库

xiongmc@xiongmc-desktop:~/project$ git clone git@172.21.20.95:Home

Cloning into 'Home'...
remote: Counting objects: 88, done.
remote: Compressing objects: 100% (77/77), done.
remote: Total 88 (delta 30), reused 0 (delta 0)
Receiving objects: 100% (88/88), 211.13 KiB, done.

Resolving deltas: 100% (30/30), done.

进入项目主目录

xiongmc@xiongmc-desktop:~/project$ cd Home/
xiongmc@xiongmc-desktop:~/project/Home$ git branch

* master

创建开发分支

xiongmc@xiongmc-desktop:~/project/Home$ git branch htt_app_home_20130726

切换到开发分支
xiongmc@xiongmc-desktop:~/project/Home$ git checkout htt_app_home_20130726

Switched to branch 'htt_app_home_20130726'

查看当前分支

xiongmc@xiongmc-desktop:~/project/Home$ git branch
* htt_app_home_20130726

master


xiongmc@xiongmc-desktop:~/project/Home$ git status
# On branch htt_app_home_20130726
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .project
# bin/
nothing added to commit but untracked files present (use "git add" to track)
#更新项目以便适合于当前环境 ,进入开发阶段。
xiongmc@xiongmc-desktop:~/project/Home$ android update project -p . -t android-17
Updated and renamed default.properties to project.properties
Updated local.properties
No project name specified, using project folder name 'Home'.
If you wish to change it, edit the first line of build.xml.
Added file ./build.xml

Added file ./proguard-project.txt

xiongmc@xiongmc-desktop:~/project/Home$ git status
# On branch htt_app_home_20130726
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .project
# bin/
# build.xml
# local.properties
# proguard-project.txt
# project.properties

nothing added to commit but untracked files present (use "git add" to track)

查看当前状态

xiongmc@xiongmc-desktop:~/project/Home$ git status
# On branch htt_app_home_20130726
# Changes not staged for commit:
# (use "git add <file>..." to update what will be committed)
# (use "git checkout -- <file>..." to discard changes in working directory)
#
# modified: res/layout-land/home.xml
#
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .project
# bin/
# build.xml
# gen/
# local.properties
# proguard-project.txt
# project.properties

no changes added to commit (use "git add" and/or "git commit -a")

提交开发分支到本地库。这里使用 qgit 做到。
xiongmc@xiongmc-desktop:~/project/Home$ qgit
xiongmc@xiongmc-desktop:~/project/Home$ gitk

xiongmc@xiongmc-desktop:~/project/Home$ git status
# On branch htt_app_home_20130726
# Untracked files:
# (use "git add <file>..." to include in what will be committed)
#
# .project
# bin/
# build.xml
# gen/
# local.properties
# proguard-project.txt

# project.properties

提交本地库到远程库,以便管理代码,共其他开发人员使用(或发布最终用户)

xiongmc@xiongmc-desktop:~/project/Home$ git push origin hht_app_home_20130726:master


1) 先把git的东西fetch到你本地然后merge后再push

$ git fetch

$ git merge

这2句命令等价于

$ git pull




评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值