PASSWORD RESET

Your destination for complete Tech news

How to exclude files/subfolder in Git .gitignore

4.71K 0
< 1 min read

To exclude a sub-folder inside a folder in .gitignore, the following can be done.

app/*
!app/subfolder/

 

app/subfolder/*
!app/subfolder/subfolder2/

This will ignore all files and sub-folders inside “subfolder” but it will ignore the “subfolder2”

Note: Using * after the slash(/) indicates that the folder can be ignored but there maybe other conditions below for other sub-folders. If the * is not kept, all the conditions below that line will be ignored for that specific folder.

Leave A Reply

Your email address will not be published.

This site uses Akismet to reduce spam. Learn how your comment data is processed.