Re: ignoring files/directories in git
From: Alex Riesen <hidden>
Date: 2016-06-15 22:45:23
mwolfe38, Sun, Sep 21, 2008 18:54:01 +0200:
In my project I have several directories I do not want to have git ignore. One of them being cache/ and the other log/ I've added them to the .gitignore file which I have in the initial directory of the repository The contents of my gitignore are: .settings .cache cache/ log/ .project However, if I do git add . It will add the files from cache and log anyways. I know git add . will add anything that hasn't been added but shouldn't it ignore files in .gitignore?
It should and indeed it does ignore them:
$ mkdir ggg && cd ggg
$ git init
Initialized empty Git repository in /tmp/ggg/.git/
$ >a
$ mkdir cache log
$ touch cache/b
$ touch log/c
$ echo cache/ >.gitignore
$ echo log/ >>.gitignore
$ cat .gitignore
cache
log
$ git add .
$ git ls-files
.gitignore
a
What is your git version and where have you got it from?
Is your .gitignore written exactly like this (case, some hidden
extension, like they do on Windows)? Any invisible characters in
.gitignore?