git_ignore_all
This script will create a .gitignore
file ignoring everything for a given Git directory ($PWD
if not given).
The following parameters are optional:
f
-
overwrite an existing
.gitignore
file
The generated file contains three sections:
It should be used as a starting point, i.e. you should remove entries which should not be ignored. |
gitignore.io can be used to add fine-grained ignores. |
Usage
$ scripts/git/git_ignore_all.sh
$ tree --noreport -a -I .git /tmp/example1
/tmp/example1
$ scripts/git/git_ignore_all.sh /tmp/example1
$ cat /tmp/example1/.gitignore
# https://git-scm.com/docs/gitignore
*~
*.tmp
*.sw[a-p]
*.orig
.DS_Store
[Dd]esktop.ini
Thumbs.db
$ tree --noreport -a -I .git /tmp/example2
/tmp/example2
├── a
├── b.txt
└── c
└── d.out
$ scripts/git/git_ignore_all.sh /tmp/example2
$ cat /tmp/example2/.gitignore
# https://git-scm.com/docs/gitignore
*~
*.tmp
*.sw[a-p]
*.orig
.DS_Store
[Dd]esktop.ini
Thumbs.db
*.out
*.txt
a
b.txt
c/