PasteFS logoPasteFS
Haseeb on 13 Sep, 2019
Raw Data
  1. .gitignore include specific file in ignored directory
  2. If you exclude application/, then everything under it will always be excluded (even if some later negative exclusion pattern (“unignore”) might match something under application/).
  3. To do what you want, you have to “unignore” every parent directory of anything that you want to “unignore”. Usually you end up writing rules for this situation in pairs: ignore everything in a directory, but not some certain subdirectory.
  4. ```
  5. # you can skip this first one if it is not already excluded by prior patterns
  6. !application/
  7. application/*
  8. !application/language/
  9. application/language/*
  10. !application/language/gr/
  11. ```
  12. **Note**
  13. The trailing /* is significant:
  14. * The pattern dir/ excludes a directory named dir and (implicitly) everything under it.
  15. With dir/, Git will never look at anything under dir, and thus will never apply any of the “un-exclude” patterns to anything under dir.
  16. * The pattern dir/* says nothing about dir itself; it just excludes everything under dir. With dir/*, Git will process the direct contents of dir, giving other patterns a chance to “un-exclude” some bit of the content (!dir/sub/).