how to ignore files in git for different directory code example Example 1: git exclude folder directory_to_exclude/ Example 2: gitignore all log files *.log !spec/*.log