ThinkChat🤖让你学习和工作更高效,注册即送10W Token,即刻开启你的AI之旅 广告
## 1.打开命令查看之前提交的版本 ``` git log ``` ![](https://box.kancloud.cn/c40c5127ce4a044d16333f5feec27bf6_581x370.png) ![](https://box.kancloud.cn/124ba6445e26e665c7ae3b671f854b95_269x91.png) 按提交顺序降序排列,Initial commit 比 git 先提交(git 是 git commit -m"git" 引号中的git) ## 2.回退到之前的版本号 git reset --hard 版本号 ``` git reset --hard xxxx ``` ![](https://box.kancloud.cn/ea2c48e01f33e57a2a8c69a7a66742b5_581x538.png) ![](https://box.kancloud.cn/72281d81d2b0509ae2d5506991124095_167x98.png) ## 3.前进到刚才的版本 ``` git reflog //查看历史命令 ``` ![](https://box.kancloud.cn/33de16c82827279e30ce12ad90779a44_581x538.png) ![](https://box.kancloud.cn/124ba6445e26e665c7ae3b671f854b95_269x91.png)