×

Git commit后, 不小心commit了多余的文件或者需要撤销, 搜到的大多数方法是回退到上个版本, 但是会导致修改的内容丢失;

  • 搜到的方法
git log 
copy [上个版本的commit id]
git reset --hard [copy commit id]

  • 撤销commit并保留修改的内容的方法
# 查看Git Log
git log
# 复制需要还原的commit id
copy [上个版本的commit id]
按Q退出log
# 撤销复制的commit id
git reset --soft [copy commit id]

发表回复

作者

xfei@live.com

相关文章

CentOS 7 打开&关闭端口

1. 防火墙的操作 CentOS 7使用的是...

读出全部

好用的idea插件

1 IDEA插件安装 IDEA的插件安装非常...

读出全部