Does .forceignore have a mechanism to ignore most files except for specific files?

With .gitignore, a ! represents the negation of the pattern – see Make .gitignore ignore everything except a few files.

So I thought this in .forceignore might ignore all the pages except the specific one:

**/pages/**
!**/pages/Setup.page

but it seems to have no effect. (Though commenting out **/pages/** doesn’t either; not sure what is going on here.)

Is there a way to do this in .forceignore?

Answer

I have had issues with this myself in the past I believe .forceignore works slightly differently to .gitignore (I may be wrong here) I believe what you are after is the following.

# ignore all pages    
**pages 

# include setup page
!**/Setup.page

If you wish to ignore just the setup page

# ignore specific file
**/pages/Setup.page

Attribution
Source : Link , Question Author : Keith C , Answer Author : Crispy

Leave a Comment