【git】当项目中存在已经提交的忽略内容应该如何剔除掉

这个方法非常管用哟

方法一: 适用于全局情况

bash 复制代码
git rm -r --cached .
bash 复制代码
git add .
bash 复制代码
git commit -m "apply .gitignore and remove ignored files"
bash 复制代码
git push

方法二: 适用于局部情况

bash 复制代码
git rm -r --cached some_dir
bash 复制代码
git rm --cached some_file
bash 复制代码
git commit -m "stop tracking ignored files"
bash 复制代码
git push
相关推荐
2401_853448234 小时前
Git安装流程和基础使用步骤
git·github
Sagittarius_A*10 小时前
Web 安全之 Git 泄露:原理剖析 + CTFHub Log/Stash/Index 全题型解法
git·安全·web安全
lazy H11 小时前
从入门到日常开发,一篇文章掌握 Git 核心操作
git·后端·学习·github
zzqssliu19 小时前
煤炉自动代拍系统的队列设计与超时控制机制
git·github
一支绝命钩19 小时前
FPGA工程Git常用操作手册
git
不搞学术柒柒1 天前
Git新功能完整开发提交流程
git
午安~婉1 天前
Git中SSH连接
前端·git·gitee
888CC++1 天前
VS Code Git 工作树:解锁多分支并行开发新体验
git
阿虎儿1 天前
Git exclude 功能解析
git
隔窗听雨眠1 天前
VS Code Git工作树:多分支并行开发的完整实践方案
git