Git Ignore File

In some circumstances, we would like to ignore the files (or directories) under the Git repository base directory. How could we do this? For example, assume that we have a Git repository with following files:

out/bin/conv
preprocessed/out/gen-case1.h
preprocessed/out/gen-case2.h
preprocessed/input.txt
conv.cpp

If we would like to ignore the out directory but not the preprocessed/out directory, then we can add following line to .gitignore file:

/out

Please notice that there is an leading slash character at the beginning of the path. Without the leading slash, all of the files (or directories) named after out will be ignored.