git
git init 初始化git仓库
![](https://img.haomeiwen.com/i18600871/2b5367a76172e003.png)
配置用户名:git config --global usre.name 'wangzhanhan-bit'
配置用户邮箱:git config --global user.email '2593983614@qq.com'
![](https://img.haomeiwen.com/i18600871/fbe5c2e21c518a2b.png)
把文件放进仓库
新建文件admin.txt,输入内容
![](https://img.haomeiwen.com/i18600871/72bc57a9574301b8.png)
![](https://img.haomeiwen.com/i18600871/96dbf05aec39104a.png)
git add 文件目录/文件名 或者使用 git add ./意思是把当前路径下的所有文件放到存储区
git commit -m "说明 或者使用git commit --all -m"说明“把所有文件放到仓库中。
![](https://img.haomeiwen.com/i18600871/439f6f47a0464560.png)
git status察看文件状态命令
查看历史提交日志git log(git log --oneline 查看简介版日志)
![](https://img.haomeiwen.com/i18600871/940af0cffc0bdd00.png)
git reset --hard Head~0后退到上一次的代码(git reset --hard 版本号)
![](https://img.haomeiwen.com/i18600871/e4dfc794fe5221ac.png)
![](https://img.haomeiwen.com/i18600871/dff157100970acae.png)
git reflog 可以看到每一次切换版本的记录
![](https://img.haomeiwen.com/i18600871/a8734f1a2318066b.png)
![](https://img.haomeiwen.com/i18600871/f226935bb85efa2c.png)
创建分支 git branch 分支名(例:git branch dev创建dev分支)
git branch 查看当前有哪些分支
![](https://img.haomeiwen.com/i18600871/e626ce7461bd907b.png)
切换分支 git checkout 要切换的分支名(例:git checkout dev 切换到dev分支)
![](https://img.haomeiwen.com/i18600871/daa5080e274fc654.png)
合并分支git merge dev 把当前分支与指定的dev分支结合
![](https://img.haomeiwen.com/i18600871/a7942ab03b95c079.png)
git pull https://github.com/user.name/text1.git master上传
git push https://github.com/user.name/text1.git master下载
在pull和push中先pull在push
![](https://img.haomeiwen.com/i18600871/0d701717e72dd448.png)
git remote add origin https://github.com/user.name/text1.git master
git push origin master
前一句使用后相当于给此项目一个origin代替地址方便后续操作
git push origin -u master
git push
前一句使用后相当于给了一个关联使得后续操作变得简单省略master。