当前位置: 代码网 > it编程>编程语言>其他编程 > 清除git本地缓存和gitigore模板方式

清除git本地缓存和gitigore模板方式

2026年03月11日 其他编程 我要评论
一、清除git本地缓存首先 .gitignore 只能忽略那些没有被追踪(track)的文件,且git存在本地缓存。如果需要过滤文件之前已纳入了版本管理,那么除了修改ignore文件,还要清除本地缓存

一、清除git本地缓存

首先 .gitignore 只能忽略那些没有被追踪(track)的文件,且git存在本地缓存。

如果需要过滤文件之前已纳入了版本管理,那么除了修改ignore文件,还要清除本地缓存。

git rm -r --cached .
git add .
git commit -m "update .gitignore"

二、ignore文件模板

1. 后端

# compiled class file
*.class

# log file
*.log
*.imi
*.lst

# bluej files
*.ctxt

# mobile tools for java (j2me)
.mtj.tmp/

# package files #
*.jar
*.war
*.nar
*.ear
*.zip
*.tar.gz
*.rar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*

.idea
*.iml
out
.settings/
.project
.classpath
/*/target/
logs/
.txlcn

# ignore test file
**/src/test/

2. 前端

.ds_store
# node_modules 正常工作时需要过滤该文件
/dist

# local env files
.env.local
.env.*.local

# log files
npm-debug.log*
yarn-debug.log*
yarn-eroor.log*
pnpm-debug.log*

# editor directories and files
.idea
.vscode
*.suo
*.ntvs*
*.njsproj
*.sln
*.sw?

总结

以上为个人经验,希望能给大家一个参考,也希望大家多多支持代码网。

(0)

相关文章:

版权声明:本文内容由互联网用户贡献,该文观点仅代表作者本人。本站仅提供信息存储服务,不拥有所有权,不承担相关法律责任。 如发现本站有涉嫌抄袭侵权/违法违规的内容, 请发送邮件至 2386932994@qq.com 举报,一经查实将立刻删除。

发表评论

验证码:
Copyright © 2017-2026  代码网 保留所有权利. 粤ICP备2024248653号
站长QQ:2386932994 | 联系邮箱:2386932994@qq.com