Home  >  Q&A  >  body text

.gitignore 如何仅忽略根目录下的index.html

.gitignore 如何仅忽略项目根目录下的 index.html 但不忽略子目录的 index.html

index.html

这样子写吗?

天蓬老师天蓬老师2727 days ago658

reply all(4)I'll reply

  • phpcn_u1582

    phpcn_u15822017-05-02 09:27:42

    /index.html will do.
    This involves the matching problem of gitignore. If it does not start with / (slash), git will match all index.html in the directory. After adding /, it will match according to the path

    reply
    0
  • 过去多啦不再A梦

    过去多啦不再A梦2017-05-02 09:27:42

    @老老哥 is right, the questioner should do exactly what he said!

    reply
    0
  • PHP中文网

    PHP中文网2017-05-02 09:27:42

    ./index.html

    reply
    0
  • PHP中文网

    PHP中文网2017-05-02 09:27:42

    If your gitignore is also on the root (usually it is).
    You just need to add a line index.html in gitignore.

    reply
    0
  • Cancelreply