git命令

git reset --soft fd35h567 (fd35h567表示git log看到的提交号)

           --soft
               Does not touch the index file nor the working tree at all (but resets the head to <commit>, just
               like all modes do). This leaves all your changed files "Changes to be committed", as git status
               would put it.

    作用: 将版本fd35h567之前的提交都置为未提交,在本地可以看到未提交的代码。

git reset --hard fd35h567

           --hard
               Resets the index and working tree. Any changes to tracked files in the working tree since
               <commit> are discarded.
             作用: 将版本fd35h567之前的提交都丢弃

git stash pop

            将git reset --hard fd35h567丢弃的提交彻底删除

原文地址:https://www.cnblogs.com/lixiaolun/p/6645760.html