简体   繁体   English

无法忽略顶级文件夹及其中的所有内容

[英]Unable to ignore top-level folder and everything in it recursively

I've committed a file in a folder previously and nothing I put in .gitignore is now ignoring the folder and everything in it. 我之前已经在文件夹中提交了文件,而我在.gitignore中放的任何内容现在都忽略了该文件夹及其中的所有内容。 I've tried committing: 我试过提交:

.vscode .vscode/ .vscode/* .vscode/** .vscode .vscode/ .vscode/* .vscode/**

Even with / at the beginning of each of those... .vscode and its contents keep showing up in git status . 即使在/的开头,.vscode及其内容始终以git status

If I commit .vscode/settings.json to .gitignore, the file keeps showing up in status whenever I make a change. 如果我将.vscode/settings.json提交给.gitignore,则每当我进行更改时,文件就会一直显示在状态中。

How am I supposed to get git to just start ignoring this folder and all of its contents? 我应该如何让git开始忽略该文件夹及其所有内容?

.gitignore will only ignore files that are untracked. .gitignore将仅忽略未跟踪的文件。 You would need to first remove the file from version control before git will ignore that path. 您需要先从版本控制中删除文件,然后git才会忽略该路径。

git rm -r --cached vcscode
git commit -am 'Untrack /vcscode'

At this point.. changes should not be tracked 在这一点上..更改不应被跟踪

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何忽略除顶级目录中的几个文件以及.gitignore的几个目录中的所有内容之外的所有内容 - How do I ignore everything except a couple files in the top-level directory and everything in a few directories with .gitignore 如何排除除了所有顶级点文件和子目录之外的所有内容? - How can I exclude everything but all top-level dot files and a subdirectory? Gitignore:忽略所有 .vscode 目录,但包括顶级 launch.json - Gitignore: Ignore all .vscode directories, but include the top-level launch.json 递归忽略git中的文件夹 - Recursively ignore folder in git Git重命名顶级项目文件夹,而不会弄乱下游 - Git rename top-level project folder without messing up downstream .gitignore 忽略与某些顶级子目录关联的嵌套子目录中具有某些扩展名的文件之外的所有内容 - .gitignore to ignore everything aside from files with certain extensions in nested subdirectories associated with some top level subdirectories .gitignore排除目录下的目录,但不排除顶级文件 - .gitignore exclude directories under directory, but not top-level files 如何使用 git 扁平化两个顶级合并提交 - How to flatten two top-level merge commits using git Git:所有文件都在子目录中,但它们应该是顶级的 - Git: all files are in a subdirectory, but they should be top-level 除了顶层以外,如何使用.gitignore排除文件类型? - How to exclude a filetype with .gitignore except in the top-level?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM