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

后端 未结 3 1652
被撕碎了的回忆
被撕碎了的回忆 2021-02-20 02:00

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 cha

3条回答
  •  忘掉有多难
    2021-02-20 03:00

    even though I had just added them using the wildcard: git add *.js

    Shell wildcard expansion does not recurse into subdirectories. The wildcard is expanded before Git gets a chance to see it.

    If you use git add '*.js', then Git will see the wildcard and will match it against all path names that end in .js. Because the * is in the initial position, this will end up recursively adding all .js files including in subdirectories.

提交回复
热议问题