dde*_*ral 4 git gitignore node.js visual-studio-code
我试图让 git 忽略我在 node_modules/ 中的文件,但它似乎不接受此更改。
这是我的.gitignore文件的内容:
node_modules/
Run Code Online (Sandbox Code Playgroud)
这是我的项目结构:
我希望 git 忽略 node_modules 文件夹和其中的所有文件/文件夹,但相反,我将大量更改列为待处理,即使我在根目录中执行 git 状态, node_modules/ 也被列为待办的。是否有一些关于 Windows 的命名法使 git 行为异常?
/之前添加node_modules/,应该像
/node_modules/
# ^ forward slash before the folder name signifies root dir
Run Code Online (Sandbox Code Playgroud)
如果您只想排除 node_modules 文件夹中的特定文件,您还可以执行一些操作,例如/node_modules/*.json排除根 node_modules 文件夹中带有.json扩展名的所有文件。
| 归档时间: |
|
| 查看次数: |
8808 次 |
| 最近记录: |