忽略.gitignore文件本身 [英] Ignore the .gitignore file itself
问题描述
git init
code> .gitignore file。 现在,当我键入 git status
, .gitignore 文件出现在未跟踪文件列表中。为什么会这样?
git status
所示。它必须是存储库树的一部分,以便对其进行更改等。
因此,将其添加到您的存储库中,它不应该是gitignored。
如果您确实希望将 .gitignore
添加到 .gitignore
文件,如果你不希望它被提交。但是,在这种情况下,最好将忽略添加到 .git / info / exclude
,这是一个特殊的签出本地文件,与.gitignore一样运行,但不显示在git status中,因为它位于 .git
文件夹中。
另见 https://help.github.com/articles/ignoring-files
I just did a git init
on the root of my new project.
Then I created a .gitignore
file.
Now, when I type git status
, .gitignore file appears in the list of untracked files. Why is that?
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.
See also https://help.github.com/articles/ignoring-files
这篇关于忽略.gitignore文件本身的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!