This question already has an answer here:
- Make .gitignore ignore everything except a few files 18 answers
What should I put in my Git repository's .gitignore
to exclude all files and directories there except specific ones. For example if I have a large number of files and directories in a repo, and just want Git to track fileX
, .fileY
, and directoryZ
, but completely ignore everything else, what should be in my .gitignore
?