How To Refresh/Update .gitignore File

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:

  1. Make changes in .gitignore file
  2. Right click your project and then click Git Bash Here to open Git command line

    Git Bash Here
  3. Run git rm -r –cached . command  to clear Git cache
  4. Run git add . command to add all the files (with changes) in a repository to the staging area
  5. 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.

Also, check Display ‘st’, ‘nd’, ‘rd’ And ‘th’ Suffix After Day Numbers With Dates In C#

Submit a Comment

Your email address will not be published. Required fields are marked *


Select Categories