GET的常用命令

1.GIT的全局配置

$ git config - l 查看配置信息
$ git config --global -l 查看全局配置信息

2.配置:

$ git config --global user.name 'xxx'
$ git config --global user.eamil 'xxx'
clear : 清屏

3.创建仓库:

$ git init //会生成一个隐藏文件夹(.git : 暂存区和历史区等的信息)

4.提交到暂存区:

$ git add xxx 把某个文件提交到暂存区
$ git add . 把当前仓库中的所有修改了的文件提交到暂存区
$ git status 查看当前文件的状态(红色:在工作区 , 绿色:暂存区 , 无:历史区)
$ git rm -- cached xxx :将文件xxx从暂存区移除

5.提交到历史区

$ git commit -m‘xxxx’ //xxx:描述
$ git log //查看历史区信息
$ git reflog //查看历史版本信息 (包含回退的版本)

6.版本回退:

$ git reset --hard xxx //xxx为要回退到的版本号

7.上传到中央仓库:

$ git remote -v // 查看本地仓库与中央仓库的连接状态
$ git remove add origin [GIT仓库地址]
$ git remote rm origin //取消与中央仓库的关联 orgin为名字

$ git pull origin master //从中央仓库拉去数据 (需要输入github密码)
$ git push origin master // 上传到中央仓库

$ git clone [中央仓库地址] [别名]

猜你喜欢

转载自www.cnblogs.com/zoukun/p/12114192.html