git彻底删除某些文件(文件夹)在仓库中的记录

作者在 2026-02-10 03:31:31 发布以下内容
sudo apt install git-filter-repo

# 删除单个文件
git filter-repo --invert-paths --path secret.txt

# 删除整个文件夹
git filter-repo --invert-paths --path logs/

# 压缩优化
git gc --aggressive --prune=now
git repack -a -d --depth=250 --window=250

作者在 2026-03-15 23:40:33 补充以下内容
强推到远程仓库后,远程仓库会变的很大,也要进行压缩优化
# 压缩优化
git gc --aggressive --prune=now
git repack -a -d --depth=250 --window=250

Git | 阅读 1719 次
文章评论,共0条
游客请输入验证码
浏览3164799次
文章归档
最新评论
  • 静夜思:感受ai的强大魔力吧👍
  • 静夜思:-1是多核