【情况1:内容已经提交至远端,想要撤回】

慎重使用!!!

  1. step1
git log

找到你想要返回的版本的commit_id 一般是黄色的 由字母和数字组成的字符串
在这里插入图片描述
2. step2

git reset --hard <版本号>
eg:
git reset --hard commit_id(9bb1278da2fb698a78fd676ea42c16d413a35e31)
  1. step3
 git push origin <分支名> --force
 eg:
 git push origin master --force

即可实现抹去commit_id后面所有的提交内容,慎重使用!!!

【情况2:想要撤回本地自上次pull之后所有的修改】

慎重使用,抹去本地所有修改过的内容包括txt、log、model文件

git stash

更多推荐