- 直接回退到上个版本
git log
git reset --hard <commit id>
会退到上个版本,但是不会保留之前的修改
- 回到上个版本,并且保留在 index 缓存区
git log
git reset --soft <commit id>
- 回到上个版本,但是不保留在 index 缓存区
git log
git reset --mixed <commit id>
git log
git reset --hard <commit id>
会退到上个版本,但是不会保留之前的修改
git log
git reset --soft <commit id>
git log
git reset --mixed <commit id>