vscode 的git 默认是没有忽略文件的,需要单配置
一、 windows 中先在当前用户根目录下创建一个全局要忽略的文件列表.gitignore_global
.idea/
.DS_Store
node_modules/
package-lock.json
yarn.lock
.vscode/
.history/
logs/
target/
pid
window下 只有扩展名的文件不让保存,可以在 git bash中创建文件
二、 然后在命令行下执行下面git 命令
git config --global core.excludesfile "%USERPROFILE%\.gitignore_global"
这样就不用在每个项目中都创建 .gitignore 文件了
三、 在使用vscode 时git 忽略的文件可能会编辑器中显示,可以在settings.json 中加入排除选项
"search.exclude": {
"**/node_modules": true,
"**/bower_components": true,
"build/": true,
"temp/": true,
"library/": true,
"**/*.anim": true
},
"files.exclude": {
"**/.git": true,
"**/.svn": true,
"**/.hg": true,
"**/CVS": true,
"**/.DS_Store": true,
"**/*.meta": true,
"**/.history": true,
"**/.idea": true,
"**/idea": true,
"**/logs": true,
"**/target": true,
"**/pid": true,
}
**粗体** _斜体_ [链接](http://example.com) `代码` - 列表 > 引用
。你还可以使用@
来通知其他用户。