![](https://img-blog.csdnimg.cn/img_convert/323ef376bdee7c9709e49c98636ff0f2.png)
![](https://img-blog.csdnimg.cn/img_convert/fc6685c29e93438f7f35180766d70107.png)
获取本地仓库
git init 初始化Git仓库
git status 查看Git仓库状态
![](https://img-blog.csdnimg.cn/img_convert/98cd39e63b55ba5426c2bb60ab85e861.png)
![](https://img-blog.csdnimg.cn/img_convert/0af78023327592929369c3da21caaaca.png)
git status查看修改状态(暂存区、工作区)
git add (文件名|通配符) 将所有修改加入暂存区
git commit -m "注释" 提交暂存区到本地仓库
![](https://img-blog.csdnimg.cn/img_convert/8339ec81cd45fca2c7c2b32f2ca88369.png)
git log 简单展示日志
git-log 详细展示日志
git reset --hard.commitID 版本回退(通过git-log查看ID)
git reflog(查看已经和删除的提交记录)
clear 清楚命令
.gitignore 不需要git管理操作的东西
分支
![](https://img-blog.csdnimg.cn/img_convert/8e2be8c1c8f3bf86a9b431301fcb1eaf.png)
![](https://img-blog.csdnimg.cn/img_convert/9de905114b02fb03289581f1aa6bfc01.png)
![](https://img-blog.csdnimg.cn/img_convert/d9d33b418c020ccb6dda3798ef926077.png)
![](https://img-blog.csdnimg.cn/img_convert/effaafefe1835832582d772405c96d7c.png)
添加仓库的SSH公钥
GitHub添加公钥_github怎么添加公钥-CSDN博客
本地项目推送给github仓库
【git】本地项目推送到github、合并分支的使用_git push到github-CSDN博客
![](https://img-blog.csdnimg.cn/img_convert/40ae54adc859149ba91d319493862c63.png)
git branch -vv 显示本地分支关联的远程仓库
![](https://img-blog.csdnimg.cn/img_convert/635b79bd80e72bf481fa28e78705ea10.png)
![](https://img-blog.csdnimg.cn/img_convert/ea6973eedf4468601e7b8b968e4d67eb.png)
最后结论,不如在idea里面 直接操作
摘自黑马课和wrt佬的文章