-
Notifications
You must be signed in to change notification settings - Fork 22
git清除提交记录
L edited this page Apr 5, 2021
·
2 revisions
转载自Git彻底删除历史提交记录的方法
因为提交了过大的文件,导致提交报错
remote: error: File: e0c9af59e64d2b21d6ac57d16e000e0935ba06d1 186.04 MB, exceeds 100.00 MB.
remote: Use command below to see the filename:
remote: git rev-list --objects --all | grep e0c9af59e64d2b21d6ac57d16e000e0935ba06d1
remote: Please remove the file from history and try again. (https://gitee.com/help/articles/4232)
To your res
! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to '...'
提示说需要删除该文件及其提交记录,参考https://gitee.com/help/articles/4232 ,也可以选择以下方法(比较粗暴)
1、查看Git提交记录
git log
2、找到需要回滚到的提交点,复制它的hash值
reset到该提交点
git reset --hard 你复制的hash值
3、将当前指向的head推到git
it push --force
即清除了该提交点之后的所有提交