Difference when ignoring files in folder with git

This question already has an answer here:

  • How can I add an empty directory to a Git repository? 28 answers

  • git does not track empty folders, thus if it thinks nothing is inside of it, it won't add it. One solution to your problem would be instead of adding /tmp/* to your global .gitignore file, put one into the /tmp/ folder, just containing

    *
    !.gitignore
    

    and commit this file. In this way, /tmp/ won't be empty to git and thus be added to the repository, but no further files would be.

    链接地址: http://www.djcxy.com/p/7876.html

    上一篇: 使用gitignore创建存储库

    下一篇: 使用git忽略文件夹中的文件时的差异