.gitignore ignore invalid target

If you want to ignore a file, not the file submitted to the git repository, methods to modify the root directory .gitignore files can be used.
But sometimes in the project development process, a sudden whim or want certain directories files added to ignore the rules, defined as described above after the discovery did not take effect because .gitignore only to ignore those files had not been the track, if some files have been included in the version management, modifying .gitignore is invalid. Then the solution is to first delete the local cache (not track changes to the state), and then submitted to:

git rm -r --cached .
git add .
git commit -m 'update .gitignore'

ok !!!
Reference Links: https://blog.csdn.net/hujun_123456/article/details/78062224

Guess you like

Origin www.cnblogs.com/proper128/p/11299265.html