Git基础命令学习笔记
Git基础命令学习笔记
本文搬运自本人高中时期CSDN博客,若图片加载不出来,可到原文查看:https://blog.csdn.net/zhangtingxiqwq/article/details/161336335
你现在在你的文件夹内打开cmd
开始
1 | git init |
修改
1 | git add . |
在本地随便commit都没有任何问题,不会上传到github,方面本地备份代码。
上传github
-
先在github上建一个仓库
-
第一次推送
1 | git remote add origin 仓库地址 |


- 之后直接推送:
1 | git push |
Commit相关
查看日志:
1 | git log |
一步add+commit:
1 | git commit -a -m "version2" |
如果说明写错了:
1 | git commit --amend -m "this is the true discription" # 说明写错了 |
回退版本
1 | git reset --soft HEAD^ # 回退到上一个版本 |
但这样子只是让你的head指针回退,你的文件并没有,所以可以采取以下两种办法:
1 | git reset --hard a1b2c3 # 强制回退 |
拉取
这个还没仔细研究过
1 | git pull |
本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明来源 zhangxixi的博客!





