[英]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.