git之rm操作

从未push的最近一次commit中删除

使用git rm -cachedgit commimt amend -CHEAD命令

git rm --cached file     # 从缓存中删除,在disk中保留
git commimt amend -CHEAD # 修补上次commit

从较早的commit中删除

使用git filter-branch操作或者BFG Repo-Cleaner工具。
参考博客https://www.cnblogs.com/imzhizi/p/delete-files-thoroughly-using-bfg.html

https://help.github.com/en/github/managing-large-files/removing-files-from-a-repositorys-history
https://help.github.com/en/github/authenticating-to-github/removing-sensitive-data-from-a-repository

原文地址:https://www.cnblogs.com/zi-wang/p/12350295.html