hguser
hguser

Reputation: 36068

gitignore does not work as expected

It seems that the .gitignore does not work, some file match the pattern defined in the file are still added to git.

And I have googled, someone said that the files which exist in the git can not be ignored.

So in my working directory, I create the .gitignore file, which contains this:

*/out/*

Then I run

git init
git add -A

But when I run git status it tell me that the files "out/xxxx.xxx" are added and to be committed.

What's the problem?

It seems that the git init and git add command does not care about the .gitignore file, isn't it?

Upvotes: 1

Views: 181

Answers (1)

Agis
Agis

Reputation: 33666

Use out/* instead of */out/*.

*/out/* will ignore files with paths like foo/out/bar.

Upvotes: 2

Related Questions