What to do when gitignore is not ignoring files as expected

What to do when gitignore is not ignoring files as expected