1

my .gitignore file contain /var/ folder:

/.idea
/media/
/var/
/errors/

but files from var/cache/ and /.idea appears regularly on new commits.

Yes, I did git init for entire project at the beginning, but also did git rm -r --cached var/ as suggested in https://stackoverflow.com/a/1330097/6827096 but new files still appears. enter image description here

Community
  • 1
  • 1
user6827096
  • 1,186
  • 1
  • 11
  • 26

1 Answers1

2

I think it should be, it depends where the gitignore file is. If itś in the same directory as the folders do something like this:

.gitignore
.idea
/media
/var
/errors

or:

 .gitignore
 .idea
 media
 var
 errors

I would post this as a comment but I dont have enough rep for that yet.

Arnold
  • 175
  • 12
  • I must remove approval as it still adding new files from these directories. – user6827096 Jan 19 '17 at 01:59
  • Okey, can you also remove the .gitignore line? Because you must commit the gitignore aswell. And try running git rm r --cached for all those folders. – Arnold Jan 19 '17 at 11:13
  • thanks you still there. I did it much earlier and still get these files. I will document detailed steps I do and put in main post later cause its looks like I'm doing it wrong way. Anyway main post contain updated version of my .gitignore. – user6827096 Jan 19 '17 at 14:56
  • I don't know if you solved it yet, but one other problem could be that you didn't upload the gitignore file. (`git add .`) than commit it. (`git commit -m "added untracked fles"`) Please let me know if you got any further or add additional information. – Arnold Jan 23 '17 at 10:17
  • my .gitignore looks like in my main post (and its edited based on your answer). I approved your answer as it just at some point stop adding new files from ignored directories. Im not sure why. I just did `git rm -r --cached ` couple of times and make sure git status is clean. (maybe before i didnt commit right after this command, i dont remember) – user6827096 Jan 23 '17 at 14:53