You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
After creating a .gitignore file in your repository and setting patterns to match files which you do not want Git to track, Git starts tracking repository files and respecting the patterns set in the .gitignore file after you run the git add command (For example git add .).
The problem is that if we later 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.
For example if you later set in the .gitignore file that you want Git to start tracking a file which you previously set to be ignored, the file will still be untracked if you just run the git add . command.
This is because, the git cache needs to be cleared. I usually just do this with the git rm -r --cached . then after I run the git add . command to apply the .gitignore changes.
After creating a .gitignore file in your repository and setting patterns to match files which you do not want Git to track, Git starts tracking repository files and respecting the patterns set in the .gitignore file after you run the git add command (For example git add .).
The problem is that if we later 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.
For example if you later set in the .gitignore file that you want Git to start tracking a file which you previously set to be ignored, the file will still be untracked if you just run the
git add .
command.This is because, the git cache needs to be cleared. I usually just do this with the
git rm -r --cached .
then after I run thegit add .
command to apply the .gitignore changes.Source:
https://sigalambigha.home.blog/2020/03/11/how-to-refresh-gitignore/
The text was updated successfully, but these errors were encountered: