001、初始化仓库,创建git仓库
git init
002、配置个人信息
git config --global user.name <名字> --------->:配置用户名 git config --global user.email <邮箱>--------->:配置邮箱 git config --list --------->:查看配置信息 git config --global user.name --------->:查看用户名 git config --global user.email --------> :查看邮箱
003、将工作区文件添加到缓存区
git add <文件名称>
004、查看文件状态
git status

005、将缓存区的文件添加到版本库
git commit -m "提交注释的说明" --------->将缓存区的文件添加到版本库中 并加上注释

006、查看提交的版本日志
git log

007、查看文件最新改动的地方
git diff <文件名称> --------->:查看工作区与暂存区文件的比较 git diff --cached ------------>:查看暂存区与版本库文件的比较 git diff master ------------>:查看工作区与版本区文件的比较

-开头的行,是只出现在源文件中的行
+开头的行,是只出现在目标文件中的行
空格开头的行,是源文件和目标文件中都出现的行
差异按照差异小结进行组织,每个差异小结的第一行都是定位语句,由@@开头,@@结尾
008、版本回退
git reset --hard HEAD^ --------->回退到上一个版本 git reset --hard HEAD^^ --------->回退到上上个版本 git reset --hard HEAD~N --------->回退到第N个版本 N是一个整数 git reset --hard 版本号 --------->回退到指定版本

009、查看所有版本号
git reflog

010、删除操作
git rm <文件名称> --------->删除暂存区
或分支
上的文件, 同时工作区也不需要这个文件 git rm -f <文件名称> --------->强制删除文件 git rm --cached <文件名称> --------->删除暂存区
或分支
上的文件, 但本地又需要使用, 只是不希望这个文件被版本控制
011、git推送
git push -u origin master --------->将文件上传到github上 git remote --------->查看远程仓库名称 默认 origin git remote -v --------->查看当前的远程仓库名称和对应的地址

012、克隆
git clone <仓库地址>
013、创建分支
git branch --------->:查看本地分支列表 git branch <分支名称> --------->:新建分支 git checkout -b <分支名称> --------->:新建并切换分支 git checkout <分支名称> --------->:切换分支

014、分支提交
git push origin <分支名称>

015、获取秘钥,并查看秘钥
ssh-keygen -t rsa -C <邮件名称> ------->获取秘钥 cat ~/.ssh/id_rsa.pub ------->查看秘钥
016、更新本地仓库
git fetch --all --------->:更新git remote 中所有的远程仓库所包含分支的最新commit-id
git pull --------->:将本地库更新至远程库的最新状态
017、合并文件
git merge <分支名称>