Git 回退代码到某次 commit
Siona
Git 回退代码到某次 commit
注意:此处是 commit 到本地仓库(还没有推送到远程仓库)。
1. 查看 commit 日志
siona@siona-Mac-mini erp % git log
commit 1372742bfe169837587a0d972b86ce8c480dcd4d (HEAD -> main, origin/main)
Author: siona <xxx@qq.com>
Date: Fri Apr 26 11:30:10 2024 +0800
fix 工作流 service node's spel
commit 1a79769c78fef5b0d075da40eff3de323f0949d1
Author: siona <xxx@qq.com>
Date: Thu Apr 25 10:58:21 2024 +0800
fix
commit 706c3fa5787c004270164e5cd486c1a8095da35b
Author: siona <xxx@qq.com>
Date: Wed Apr 3 11:22:41 2024 +0800
feat HighCharts Gantt
2. 回滚、取消之前的提交
# 回滚到指定版本(sha 码)(该版本及之后的所有 commit 全部取消)
git reset --hard 1a79769c78fef5b0d075da40eff3de323f0949d1
3. 成功后,可重新提交【非必须】
git commit a.txt -m "重新提交的文件"
拓展
通过 IDEA RESET。

