本文在github创建项目,介绍git的基本使用。
1、首先在https://github.com创建自己的远程代码库,本人已创建的地址为https://github.com/qerooy/common.git;
2、本地安装好git客户端,目前最新版本为Git-1.9.4,可在http://git-scm.com/下载;
3、使用Git Bash获取远程代码库代码,执行命令git clone https://github.com/qerooy/common.git,将远程代码库更新到本地
[img]http://dl2.iteye.com/upload/attachment/0098/2997/2479e895-cec4-35b9-b367-144992dad303.png[/img]
4、在本地的代码库中添加项目文件,将项目文件同步到远程代码库中,执行以下命令
git add * 将当前更改或者新增的文件加入到Git的索引中;
git commit -m "first commit" 提交当前工作空间的修改内容;-m表示提交注释
[img]http://dl2.iteye.com/upload/attachment/0098/3003/de9b39df-d220-3d5b-9419-b852b58a515d.png[/img]
git push 将本地commit的代码更新到远程版本库中,其中需输入用户名及密码
[img]http://dl2.iteye.com/upload/attachment/0098/3007/e0695a5b-ad07-3f6b-aa02-b508151161c2.png[/img]
git pull 将远程的版本库代码更新到本地
1、首先在https://github.com创建自己的远程代码库,本人已创建的地址为https://github.com/qerooy/common.git;
2、本地安装好git客户端,目前最新版本为Git-1.9.4,可在http://git-scm.com/下载;
3、使用Git Bash获取远程代码库代码,执行命令git clone https://github.com/qerooy/common.git,将远程代码库更新到本地
[img]http://dl2.iteye.com/upload/attachment/0098/2997/2479e895-cec4-35b9-b367-144992dad303.png[/img]
4、在本地的代码库中添加项目文件,将项目文件同步到远程代码库中,执行以下命令
git add * 将当前更改或者新增的文件加入到Git的索引中;
git commit -m "first commit" 提交当前工作空间的修改内容;-m表示提交注释
[img]http://dl2.iteye.com/upload/attachment/0098/3003/de9b39df-d220-3d5b-9419-b852b58a515d.png[/img]
git push 将本地commit的代码更新到远程版本库中,其中需输入用户名及密码
[img]http://dl2.iteye.com/upload/attachment/0098/3007/e0695a5b-ad07-3f6b-aa02-b508151161c2.png[/img]
git pull 将远程的版本库代码更新到本地