Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

git

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?

like image 501
alexchenco Avatar asked Dec 24 '15 07:12

alexchenco


2 Answers

The problem is that you already uploaded the folder .sass-cache to the server. You see that it says modified. You have to do:

git rm .sass-cache/*
git commit -a -m "removed folder"
git push origin master

The next time you do git status you won't see the folder.

Also, you don't need to add both

/.sass-cache
.sass-cache

Only the last one is enough

like image 69
hoaphumanoid Avatar answered Sep 18 '22 08:09

hoaphumanoid


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.

like image 41
Makoto Avatar answered Sep 17 '22 08:09

Makoto