0 votes
1 view
in DevOps and Agile by (30k points)

I want to ignore all files in my repository except those that occur in the bin subdirectory. I tried adding the following to my .gitignore:



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

1 Answer

0 votes
by (51.2k points)

To ignore the root file and root directories you could use:




The above commands will ignore the root directories and root files, then un-ignores the root bin directory. Thus, you will get all of the bin directory, which includes subdirectories and their files.

This is the way to tell git to ignore everything except subdirectories.

Welcome to Intellipaat Community. Get your technical queries answered by top developers !