Git基础操作:push提交多个文件成功后如何撤销回退某个文件,回退代码到某次commit

之前写过类似的一篇文章 Git基础操作:push提交成功后如何撤销回退,回退代码到某次commit

按照那个示例,把期间所有commitid下的文件都会回滚掉,但是如果只想将其中某个文件回滚可以下面的示例来搞。

git log OneBean.java
commit 20ebdf62fdcd8cd7dba690b619c6bcb1d8329e28 (HEAD -> feature/mytestbanch)
Author: aa 
Date:   Fri Jun 12 17:53:30 2020 +0800

    somecommit3 manay files

commit cbf5dbf3643ca5b6a69302ff799bc647138a6f2d
Author: aa 
Date:   Fri Jun 12 17:53:06 2020 +0800

    somecommit2 manay files

commit e9bde4a5f17d138c59ce10552e0af66318b4aac5 (origin/feature/mytestbanch)
Author: aa 
Date:   Fri Jun 12 17:02:02 2020 +0800

    somecommit1 manay files

commit ee52bd20937d54cbbd86c45aa6b25a6d5c90781d
Author: bb 
Date:   Tue Sep 24 17:32:32 2019 +0800

    somecommit0 manay files

git reset ee52bd20937d54cbbd86c45aa6b25a6d5c90781d  OneBean.java

git checkout OneBean.java




你可能感兴趣的:(git)