git add commit file to gitignore code example
Example 1: apply gitignore after commit
git rm --cached $file
Example 2: gitignroe remove folder
git rm -r --cached some-directory
git commit -m 'Remove the now ignored directory "some-directory"'
git push origin master