How to deal with the invalidation of gitignore files
Here we need to analyze the invalidation situation:
1. The file has been added to the temporary storage area, and then the filtering restrictions are added in gitignore
as shown in the figure: At this time, the .gitignore file is configured, but the .idea file The folder is still green (that is, it has been added to the git temporary storage area)
Steps to be performed at this time:
1. Remove all current files in the git temporary storage area, that is, the tracked files
Open gitbash in the root directory of git, and all subsequent operations are in the root directory
git rm -r --cached .
2. Check whether all have been removed successfully
git ls-files
3. Re-add the project folder to the git temporary storage area
At this point, the added file will go to gitignore again, and confirm whether it is filtered at this time
git add .
View the effect, as follows
So far, gitignore is back in effect