git reset --soft

撤销最后一次的git commit, 返回的是上一次提交后的修改后的git add后的结果,

git reset --mixed

git reset的默认参数, 撤销最后一次的git commitgit add, 返回的是上一次提交后的修改后的还未git add后的结果。git reset --mixed相当于git reset --soft后加上git reset HEAD <file>...

git reset --hard

直接返回到上一次的提交, 上一次提交后是什么就是什么。git reset --hard相当于git reset --mixed后加上git checkout -- <file>...

git reset --soft, mixed, hard的关系图如下图所示

git reset --soft, mixed, hard的区别

相关文章:

  • 2022-12-23
  • 2021-05-03
  • 2022-12-23
  • 2021-04-21
  • 2022-12-23
  • 2021-08-09
  • 2021-07-12
猜你喜欢
  • 2022-12-23
  • 2021-12-28
  • 2021-07-09
  • 2021-09-04
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案