【Git】.gitignore自体を差分から除外する
.git/info/exclude# git ls-files --others --exclude-from=.git/info/exclude
# Lines that start with '#' are comments.
# For a project mostly in C, the following would be a good set of
# exclude patterns (uncomment them if you want to use them):
# *.[oa]
# *~
.DS_Store
.gitignore
<PROJECT>/.git/info/exclude
に上記のように追記するだけ。
もちろん.gitignore
に記載したファイルの無視も変わらず機能する。
git rm -r --cached .gitignore
しかし.gitignore
が既にGit管理(コミット)されている場合、上記のようにキャッシュ削除しないと無視は機能しない。