Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我在我的.gitignore
.gitignore
.env .env.production .env.staging .env.uat
现在我感到困惑的是它似乎没有生效,无论是在 VS Code 上还是在我运行时git status,它都没有列出我期望删除/删除的所有文件?我一定错过了一些明显的东西,但我没有发现它
git status
VS Code 上的可视化如下:
从 VS Code 中,我期待如果添加到 的条目.gitignore,VSCode 将在文件上显示浅灰色,如上图所示。
否:您需要先从 Git 中删除它们:
git rm --cached -- .env git rm --cached -- .env.*
然后 .gitignore 将生效,VSCode 将反映这些文件的新状态。