git exlude folders code example Example 1: git exclude folder directory_to_exclude/ Example 2: gitignore all log files *.log !spec/*.log