Vscode git ignores files and folders globally

Time:2020-12-10

The GIT of vscode does not ignore the file by default and needs to be configured separately

1、 In windows, first create a global list of files to be ignored in the root directory of the current user_ global

.idea/
.DS_Store
node_modules/
package-lock.json
yarn.lock
.vscode/
.history/
logs/
target/
pid

You can create files in Git bash instead of saving files with extension in windows

2、 Then execute the following git command from the command line

git config --global core.excludesfile "%USERPROFILE%\.gitignore_global"

This eliminates the need to create a. Gitignore file in every project

3、 When using vscode, GIT ignores files that may be displayed in the editor settings.json Add exclusion options to

    "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,
    }