git在本地commit时,操作失误,错误的提交了文件,可以这样处理:
1、输入:git log --oneline 获取所有commit的基本信息,第一列是对应的序号,第二列是commit时的描述
2、git reset –-soft head^: head^是错误commit的上一次的序号,例如,我是在序号11c69e9那次提交错误,那么head^=e37bbb4,所以我需要输入:git reset –-soft e37bbb4
git reset –-soft head^:将本地commit信息回退到对应head的版本,只是回退commit中的信息,对于源码文件内容不会回退,与之相对应的是:git reset -–hard
git reset -–hard head^:将commit信息、本地源码内容全部回退到对应head的版本,使用时需小心