Unignore files in Git

In Git, every line of the file .gitignore is a regular expression that describes files that should be ignored. However, one can also add lines that state which files not to ignore.

Example:

The following example shows a configuration that ignores everything in a particular directory (./tmp) but explicitly states that PDF files in ./tmp should not be ignored:

# Ignore everything in ./tmp ...
/tmp/*

# ... but do not ignore PDF files in ./tmp
!/tmp/*.pdf

 

Leave a Reply