Search code examples
wordpressgitgitignore

I need gitignore to ignore everything except one folder and everything that is in it


I need everything to be ignored except the /wp-content/themes/spk7sy folder itself and everything that is in it.

I wrote this:

/*
!/wp-content/themes/spk7sy/

But for some reason all the files are not ignored.

Am I doing something wrong?


Solution

  • This is a little more complex

    • So first you ignore all with *
    • But not wp-content so !wp-content/
    • Then you want to ignore all in wp-content so wp-content/*
    • etc..
    *
    !wp-content/
    wp-content/*
    !wp-content/themes/
    wp-content/themes/*
    !wp-content/themes/spk7sy
    !wp-content/themes/spk7sy/*