孤之前在notion记录的随笔,参考stackoverflow一名用户的解决方式,现在搬过来
To untrack a single file that has been added/initialized to your repository, i.e., stop tracking file but not delete form your system use:
git rm --cached file name
To untrack every file that is now your .gitignore
:
First commit any outstanding code changes, and then, run this command:
git rm -r --cached .
This removes any changed files from the index(staging area), then just run:
git add .
Commit it:
git commit -m ".gitignore is now working"