alexchenco alexchenco - 6 days ago 6
Git Question

Why isn't .gitignore ignoring .sass-cache?

My project looks like this:

enter image description here

.gitignore:

/node_modules
/dist
/.tmp
/.sass-cache
.sass-cache
/bower_component


No idea why, but
.sass-cache
is still being staged:

User@User-PC MINGW64 /e/alex/istagingadmindashboard/frontEnd (deve)
$ git add .

User@User-PC MINGW64 /e/alex/istagingadmindashboard/frontEnd (deve)
$ git status
On branch deve
Your branch is up-to-date with 'remotes/origin/deve'.
Changes to be committed:
(use "git reset HEAD <file>..." to unstage)

modified: .sass-cache/a1ee9da9874bbf1b217c6f2a5cd8c2c7c5ee78fe/main.scssc
modified: app/scripts/building/uploadPage.js
modified: app/styles/main.scss
modified: app/views/building/uploadproject.html


Any ideas of why?

Answer

The .gitignore file was likely updated after that particular folder's contents were staged. To complete the circle, perform git rm -r --cached .sass-cache/.

Also, you only need one entry for it in .gitignore; preferably, one with a slash at either the front or the end to denote it as a directory.

Comments