In this article, we will learn how to refresh or update .gitignore file.
A .gitignore file specifies intentionally untracked files that Git should ignore.
Git starts tracking files and respecting the patterns set in the .gitignore file after you run the git add . command.
The problem is that when we make some changes to the .gitignore file and then just run the git add . command again, the changes made in the .gitignore file will not take effect because the git cache needs to be cleared.
Steps to clear git cache and refresh or update .gitignore file:
- Make changes in .gitignore file
- Right click your project and then click Git Bash Here to open Git command line
- Run git rm -r –cached . command to clear Git cache
- Run git add . command to add all the files (with changes) in a repository to the staging area
- git commit your changes or continue working
Your git cache is cleared and .gitignore file is updated. Please give your valuable feedback and if you have any questions or issues about this article, please let me know.