gitignore
from git
Git - gitignore Documentation
gitignore に追加したファイルを除外するには
To stop tracking a file that is currently tracked, use git rm --cached to remove the file from the index. The filename can then be added to the .gitignore file to stop the file from being reintroduced in later commits.
gitignore
~/.gitignore_global を指定するのをやめ、デフォルトの置き場に置こう
デフォルトは ~/.config/git/ignore
github/gitignore: A collection of useful .gitignore templates
git add --force という、gitignore に従えば ignore されるファイルを add するコマンドがある
使わないほうがよいだろう
これによって add されてしまったファイルを知る方法
ソースコードをリポジトリに commit されているファイルだけにする。モジュールやビルドなどのアーティファクトがない状態。新しく worktree add すればよいだろう。
その状態で以下コマンドの出力結果が、--force によって add されたファイルである
$ find . -type f -exec git check-ignore -v --no-index {} \;
コマンドの意味
Git - git-check-ignore Documentation を読めば良いが
check-ignore は、引数に渡されたパスが gitignore にマッチすれば、すわなち exclude されるパスであれば出力する
commit されているファイルは通常は gitignore にはマッチしないため、結果には表示されない。--no-index をつけることで、出力させることができる。すわなち、commit されているが gitignore にマッチするファイルが出力されることになる
specs
If there is a separator at the end of the pattern then the pattern will only match directories, otherwise the pattern can match both files and directories.