"git add *.js" did not add the files in sub-directories

Viewed 6388

Was trying to commit some changes. I used git add to add any new javascript files that I may have created using the wildcard *.js. Then I committed changes and pushed to github:

git add *.js
git commit -m "stuff"
git push github master

When I checked github, all the files that I had been editing were blank. They were there, just empty.

I then tried to commit again, but GIT said that everything was up to date.

Then I went back and noticed that after I did git commit -m "stuff", GIT displayed a message saying that a bunch of my ".js" files were not staged even though I had just added them using the wildcard: git add *.js. This is the message that was displayed when I attempted to commit.

# On branch master
# Changes not staged for commit:
#   (use "git add/rm ..." to update what will be committed)
#   (use "git checkout -- ..." to discard changes in working directory)
#
#       modified:   src/static/directory1/js/module1/file1.js
#       modified:   src/static/directory1/js/module1/file2.js
#       modified:   src/static/directory1/js/module2/file1.js

In order to fix this I had to go down a few directories when doing my git add:

git add src/static/directory1/*.js

This seemed to worked, because the files were there after I committed again and then pushed to github:

git commit -m "stuff"
git push github master

What was going on here, why did I have to navigate down a few directories to get the wild card to work?

Thanks!

3 Answers
Related