git 仓库操作

一。git 仓库从远程clone

首先要建立一个本地空目录文件比如 RuntimeJsonModel,然后:

1. git init 

2. git clone https://github.com/GuoZhiQiang/RuntimeJsonModel.git

 

此时,已经 从远程 clone 了一份文件。如果 把一些工程需要的其它文件,比如 First.h First.m 放到了文件夹 RuntimeJsonModel 中,那么 提交到远程的时候,需要:

 

3. git add First.h

4. git add First.m

5. git commit -m “first”

6. git push origin master

 

二。git 本地建立仓库,然后和远程仓库对接

 

首先建立本地仓库, 假设建立了项目 CKCustomPopGesture ,在这个项目文件夹下:

 

1. git init

2. git add CKCustomPopGesture

3. git add CKCustomPopGesture.xcodeproj

4. git add CKCustomPopGestureTests

5. git commit -m "first commit"

 

然后登录 github 在 github 建立仓库CKCustomPopGesture一切保持默认选项

 

6. git remote add origin https://github.com/GuoZhiQiang/CKCustomPopGesture.git

7. git push -u origin master

 

然后可以在 github 上添加一些说明文件 比如 .gitignore , README.md ,LICENSE. 等,记得同步到本地:

8. git pull origin master

posted on 2015-08-27 16:24  guozqzzu  阅读(347)  评论(0编辑  收藏  举报