Just add the following line to your .gitignore file (the file should be located in the root of the git repo):


Excludes all directories named include. Suppose I’m in /home/droidzone/kernel and there are subdirectories like the following:


The above rule will stop git from tracking all these directories.

In most cases the directory had already been tracked by the time you added the gitignore rule. In such an instance you can remove all these tracked directories from the git with the following:

git rm --cached -r include/

To be effective it should be combined with a .gitignore rule.