banner
半米牙

半米牙的笔记

分享技术、记录生活
email

Fixing the .gitignore file not working

In the .gitignore file, files under the specified ignored directories will still appear in the push directory when pushing to git. This is because newly created files in ignored directories are cached in git. Even if some files have been included in version control, the ignore paths declared in .gitignore will not take effect.

In this case, we should first delete the local cache, and then proceed with the git push, so that the ignored files will not appear. The command to clear the local cache in git is as follows:

git rm -r --cached .
git add .
git commit -m 'update .gitignore'
Loading...
Ownership of this post data is guaranteed by blockchain and smart contracts to the creator alone.