![](https://img-blog.csdnimg.cn/54461f1e3b314505b753d17b5723323f.png)
- 配置信息
git config --global user.name "username"
git config --global user.email "email"
- 初始化
git init --bare # 裸仓库,远端
git init # 空仓库,本地
- 提交(正向操作)
git add path # 把 path目录下的所有文件添加到git暂存区
git commit path -m "注释" # 把暂存区提交到本地仓库
git push path master # 本地仓库提交到远端仓库
- 回退(逆向操作)
git reset head~1 # 从本地仓库退到工作区,退一个版本,更新的文件保留
git reset --mixed head~1 # 默认,同上
git reset --soft head~1 # 退到暂存区
git reset --mixed head~1 # 退到工作区,更新的文件也被清除
- 整理操作
git commit -amend # 修改上一次提交注释,暂存区的新文件覆盖上一次提交
git rebase
- 查看文件状态
git status # 查看文件状态
git log # 查看历史记录
git reflog # 查看历史命令
git clone 用户名@ip:/path // 把远端仓库代码拉到本地
#