.gitignore似乎不起作用 [英] .gitignore Doesn't Seem To Work

查看:88
本文介绍了.gitignore似乎不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的.gitignore:

My .gitignore:

.DS_Store
/.idea
/.idea_modules
/out
/project
/target
/*.iml
*/resolution-cache/*
*/streams/*
*/target/*

但是,尽管如此,文件夹.idea.idea_modulestarget已出现在存储库中,并且仍然存在.

But nonetheless, the folders .idea, .idea_modules and target have appeared in a repo and are still there.

您的想法?

推荐答案

忽略仅对存储库当前未跟踪的文件有用.如果这些目录在放入.gitignore之前已添加到存储库中,则将继续对其进行跟踪.

Ignoring is only useful for files that are not currently being tracked by the repo. If those directories were added to the repo before being put in .gitignore, they will continue to be tracked.

使用git rm --cached <file>停止跟踪文件.

当然,您应该使用已删除的文件进行提交,然后推送到存储库以查看远程存储库中的更改

Of course you should make a commit with the removed files and push to the repo to see the changes in the remote repository

这篇关于.gitignore似乎不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆