技术栈

彻底删除git中的某个文件(包括历史提交记录)

gsp10042024-06-24 23:19
bash 复制代码
# 加入要删除example.txt
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch example.txt' --prune-empty --tag-name-filter cat -- --all

官网https://git-scm.com/docs/git-filter-branch已经不建议用git filter-branch,而建议用 git filter-repo。

另外还有个工具叫bfg(beg-repo-cleaner)是一个用于清理Git仓库的开源工具。但是要用到java。

另外贴一个github中的文章:Removing sensitive data from a repository

上一篇:Banded Grid Views
下一篇:【C语言】顺序表(上卷)
相关推荐
stevenzqzq
1 天前
git 常用操作
大数据·git
Curvatureflight
1 天前
Git工作流最佳实践:从混乱到优雅
git
wu~970
1 天前
GitHub永不遗忘,使用git push -f来覆盖的提交依旧保留
git·github
Vermouth_00
1 天前
git clone的时候提示access denied
git
qq_43765727
1 天前
清楚本地的git并重新登录
git
jiang_changsheng
1 天前
工作流agent汇总分析 2
java·人工智能·git·python·机器学习·github·语音识别
顶点多余
1 天前
版本控制器-git
linux·git
夔曦
1 天前
Git工程日常下拉/上传完整流程(自用)
git
岱宗夫up
1 天前
GitHub Desktop如何设置中文?这不是个简单问题
git·github
岱宗夫up
1 天前
.env 文件是干啥的?为什么不能提交到 Git?
大数据·git·elasticsearch·搜索引擎·gitee·github·gitcode
热门推荐
01GitHub 镜像站点02Claude Code + GLM4.7 避坑指南:解决 Unable to connect to Anthropic services03使用 1panel面板 部署 php网站04OpenClaw Chrome扩展使用教程 - 浏览器中继控制05Vue-skills的中文文档06Linux下V2Ray安装配置指南07让 Trae IDE 智能体 “读懂”文档 Excel+PDF+DOCX :mcp-documents-reader 工具使用指南08从零搭建一个 PHP 登录注册系统(含完整源码)09UV安装并设置国内源10一文了解国产算子编程语言 TileLang,TileLang 对国产开源生态的影响与启示