Home > Software design >  Folder added it .gitignore still showing up in the Git changes
Folder added it .gitignore still showing up in the Git changes

Time:12-26

Ok so I recently upgraded to Angular 13 and now I have this folder name ".angular".

I have added its entry in .gitignore file as .angular/cache since it don't want to track it, but files inside it are always shown in git changes as Untracked files.

Almost every answer on StackOverflow tells to run the following commands.

git rm -r --cached .
git add .
git commit -m ".gitignore is now working"

All this does is staging the untracked file and then making a commit out of them. My .angular folder is still being tracked. It is still not greyed out like node_modules which means git isn't ignoring it.

Should I be doing anything different?

CodePudding user response:

If there are other folders/files in .angular and you only ignore the folder cache with .angular/cache in the .gitignore-file, the .angular folder would be continue tracked.

So you must ignore the whole .angular folder with .angular/ in .gitignore.

After this, the .angular folder would be greyed out like the node_module folder as you mentioned.

CodePudding user response:

Assuming a .gitignore in the root folder of your repository, I would try:

cd /path/to/repo
echo ".angular/cached/">>.gitignore
git rm -r --cached .angular/cached/
git add .
git commit -m "Remove and ignore .angular/cached
  • Related