banner
半米牙

半米牙的笔记

分享技术、记录生活
email

Fixing .gitignore file not working

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

In this case, we should first remove the local cache and then perform 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.