1.GIT安装
1.1. GIT下载网站
1.2. 安装步骤:一直next就可
2.GIT简介
GIT 是目前世界上最先进的分布式版本控制系统
3.GIT基础使用
3.1 配置GIT
在安装完GIT后需要配置GIT身份
$ git config --global user.name "YOUR NAME"
$ git config --global user.email "[email protected]"
3.2 工作区、暂存区、本地仓库、远程仓库
3.3 状态
3.4GIT的常用命令
# 配置用于信息
$ git config --global user.name "YOUR NAME"
$ git config --global user.email "[email protected]"
# 克隆远程仓库到本地
$ git clone url
# 将该目录变成git可以管理的仓库
git init
# 将单个文件(index.html)加入暂存区
git add index.html
# 查看文件状态(add之后会由红变绿)
git status
# 将当前目录下所有文件加入到暂存区
git add .
git add -A
# 提交到本地仓库(message:对该次提交的描述)
git commit -m<message>
# 查看日志
git log
git log -pretty=oneline
# 已经关掉过一次命令行或者内容把呢不能不知道,获取版本号:
git reflog
# 查看index.html文件修改的内容
git diff index.html
# 后悔修改了,在commit之前使用如下命令,可以回退到修改前
git reset <filename>
# 回退 版本
git reset --hard^
git reser --hard^20
# 回退到指定版本
git reset --hard 版本号
# 查看文件内容
cat index.html
# 创建新的分支
git checkout -b <name> <template>
3.5 GIT远程仓库
# 远程仓库同步到本地工作区和本地仓库
git pull
# 本地仓库同步到远程仓库
git push
# 强制push(挨揍的骚操作)
git push -f
# 本地仓库同步到远程仓库
git remote add origin clone
git push -u origin master