exlude file from directory gitignor code example Example 1: git exclude folder directory_to_exclude/ Example 2: git remove file from gitignore git rm --cached