Andrej Lavrinovic
Andrej Lavrinovic

Reputation: 160

gitignore > some ignored files still added to the repository

I don't understand why ignored files are still added to the repository. Are there some circumstances when files which are in the .gitignore list, can be still added to the repository

I added directory to the .gitignore before I did anything with the project (project is clean, no trucked or untracked files). Then I built the project. During the build process some files were modified. When the build was done, most of the modified files were ignored, but some were added to the repository. I don't understand this git's selectivity.

enter image description here

Upvotes: 2

Views: 36

Answers (1)

VonC
VonC

Reputation: 1323333

Usually, files are added to the index when modified if they were tracked before the .gitignore referenced them.

Try:

git rm --cached -r biz/modules/rest-apis/docs/refAddress

Then control that all files are ignored, by selecting one which was added before:

git check-ignore -v -- biz/modules/rest-apis/docs/refAddress/GET_1.0_v4_addresses.json

You should see a .gitignore rule (no output means: the file is not ignored).

Upvotes: 2

Related Questions