.gitignore file

less than 1 minute read


To ignore all files larger than 100MB:

find ./* -size +100M | cat >> .gitignore

To ignore all files larger than 100MB but with pathnames not contianing “data” and without repeating already added large file names:

find ./*work*/ -not -path **data**  -size +100M | sed 's|^\./||g' | cat >> .gitignore; awk '!NF || !seen[$0]++' .gitignore

An Example .gitignore file with other useful settings:

  GNU nano 2.9.3                                           .gitignore

# Blocklist files/folders in same directory as the .gitignore file

# Includelist some files

# Ignore all files named .DS_Store or ending with .log

# Includelist folder/a/b1/ and folder/a/b2/ trailing "/" is optional for folders, may match file though. "/" is NOT
# optional when followed by a *

# Adding to the above, this also works...
#!/folder/a/deeply /folder/a/deeply/* !/folder/a/deeply/nested /folder/a/deeply/nested/*

# Ignore all files larger than 150MB

Useful links: