git reset --merge
如果当前在A分支,checkout 分支到B分支后,因为很久不更新,git pull 之后 ,不想提交然后返回到A分支,会报错error: you need to resolve your current index first,可以使用
git reset --merge命令撤销,并且git log还会存在记录,然后再切换分支就没问题了
git log
commit f1164ae1611
Author: xx xx@com
Date: Day Month Year
commit msg
git checkout f1164ae1611 .
可以退到历史任意一次版本中,并且git log中还会存在,如果用git reset会删除log的记录