5

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?

1 Answer 1

5

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
8
  • Thanks but that is the approach I'm trying to avoid as I don't want to have to list the large number of pages that are to be ignored, I just want to list the one that should not be ignored.
    – Keith C
    Commented Feb 27, 2020 at 7:55
  • Then the top example is what you are after? ignore all pages except for setup?
    – Crispy
    Commented Feb 27, 2020 at 8:06
  • Yes that's right.
    – Keith C
    Commented Feb 27, 2020 at 8:19
  • check my first example in the answer 😉
    – Crispy
    Commented Feb 27, 2020 at 8:22
  • 1
    Good enough for me - thank-you!
    – Keith C
    Commented Feb 27, 2020 at 11:46

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .