简体   繁体   中英

Use .gitignore from parent directory to exclude files from search result

I'm using a workspace with 2 different folders that are part of the same reposiory. The.gitignore file for the directories is sitting in the above directory and not inside the folders.

The folder structure:

ParentDir
     .gitIgnore
     folder 1
     folder 2

Because of that VS Code doesn't exclude the files affected from.gitignore

Your help would be apprecited.

you can and should create a global.gitignore file, like this for instance:

touch ~/.gitignore_global
git config --global core.excludesfile ~/.gitignore_global

This was a limitation in VS Code, which has been resolved now that pull request #140022 is merged. Currently in VS Code Insiders you can achieve what you want by enabling the setting Search: Use Parent Ignore Files .

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