简体   繁体   中英

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. I've tried committing:

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

Even with / at the beginning of each of those... .vscode and its contents keep showing up in git status .

If I commit .vscode/settings.json to .gitignore, the file keeps showing up in status whenever I make a change.

How am I supposed to get git to just start ignoring this folder and all of its contents?

.gitignore will only ignore files that are untracked. You would need to first remove the file from version control before git will ignore that path.

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

At this point.. changes should not be tracked

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM