see my gif, in my case, I have git commit lib/file1.rb, so when i add lib/file1.rb in .gitignore, git check-ignore lib/file1.rb still return empty(lib/file1.rb is not ignored), as comparison, git check-ignore lib/file3.rb is ignored
so how to ignore file that exist in git log
