美文网首页
.gitignore 文件忽略自身

.gitignore 文件忽略自身

作者: WinddddRunner | 来源:发表于2017-08-11 16:25 被阅读0次

    .gitignore 文件忽略他本身?

    这确实是一个奇葩的需求, .gitignore 作为一个repo的一部分, 本身就应该是存在的, 如果什么都不想忽略, 那么就没必要建一个文件了.

    当然, 还是有方法解决这个问题的, 首先如果把 .gitignore 加到 .gitignore 文件中, 是不起作用的.

    不过可以加到 .git/info/exclude 这个文件中, 具体解释:

    The .gitignore file should be in your repository, so it should indeed be added and committed in, as "git status" suggests. It has to be a part of the repository tree, so that changes to it can be merged and so on.

    So, add it to your repository, it should not be gitignored.

    If you really want you can add .gitignore to the .gitignore file if you don't want it to be committed. However, in that case it's probably better to add the ignores to .git/info/exclude, a special checkout-local file that works just like .gitignore but does not show up in "git status" since it's in the .git folder.

    相关文章

      网友评论

          本文标题:.gitignore 文件忽略自身

          本文链接:https://www.haomeiwen.com/subject/phhrrxtx.html