ignoring any ‘bin’ directory on a git project

Before version 1.8.2, ** didn’t have any special meaning in the .gitignore. As of 1.8.2 git supports ** to mean zero or more sub-directories (see release notes).

The way to ignore all directories called bin anywhere below the current level in a directory tree is with a .gitignore file with the pattern:

bin/

In the man page, there an example of ignoring a directory called foo using an analogous pattern.

Edit:
If you already have any bin folders in your git index which you no longer wish to track then you need to remove them explicitly. Git won’t stop tracking paths that are already being tracked just because they now match a new .gitignore pattern. Execute a folder remove (rm) from index only (–cached) recursivelly (-r). Command line example for root bin folder:

git rm -r --cached bin

Leave a Comment