git删除文件后,清除历史commit的方法

删除某个文件的所有commit记录:
git filter-branch --force --index-filter "git rm --cached --ignore-unmatch file" --prune-empty --tag-name-filter cat -- --all

推送到远端分支
git push origin --force --all

posted @ 2025-03-28 21:02  wan了个蛋  阅读(10)  评论(0)    收藏  举报