Michael Goerz Michael Goerz - 1 year ago 74
Git Question

How do I tell Git to ignore everything except a subdirectory?

I want to ignore all files in my repository except those that occur in the

subdirectory. I tried adding the following to my


This does not have the desired effect, however: I created a new file inside of
, but doing
git status
still shows
nothing to commit (working directory clean)

Any suggestions?

Answer Source

This ignores root files & root directories, then un-ignores the root bin directory:


This way you get all of the bin directory, including subdirectories and their files.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download