git ignore a folder and its contents code example Example 1: git ignore folder command $ touch .gitignore Example 2: gitignore all files and folders in only one folder * */ !.gitignore