Shubham
Shubham

Reputation: 22317

Is .gitignore not working or I have misunderstood it?

I am very new to git. I have a .gitignore in the my working folder.

*.jpg
*.gif
*.png
system/*
*/Zend/*
.idea/*.*

Well, I did git init and then git add *. At this it worked fine and ignored the above files. But when I did some changes, ran the same command it puts the ignored files into staging area. The reason why I am using git add * is because I work on many files and adding each file would be a overkill.

Update: Here are messages when I run git add * second time..

#new file:   application/vendors/Zend/XmlRpc/Value/String.php
#new file:   application/vendors/Zend/XmlRpc/Value/Struct.php
...

The list is too long.

Upvotes: 0

Views: 2275

Answers (2)

madth3
madth3

Reputation: 7344

According to the information in this question:

wildcards in the pattern will not match a / in the pathname

therefore, I think the rule for the Zend directory is not correct.

Upvotes: 4

embedded.kyle
embedded.kyle

Reputation: 11466

git add * should complain if you have a .gitignore. See this SO question and answer. I'm not sure why it's not complaining.

Try using git add . instead as that's what you really want. Similar problem to this SO Q&A.

Upvotes: 0

Related Questions