从暂存中删除 .gitignore

remove .gitignore from the staging

我对 git 只有一个问题,那就是我有 .gitignore 正试图添加到 repo 中,但我不希望它成为,以及如何忽略忽略文件?我不想看到。git忽略任何地方。

我试过忽略它,但我只能丢弃它或删除它,那绝对不是我想做的。

要维护一个要忽略的文件列表,这不是您存储库的一部分,请不要使用 .gitignore 文件。相反,编辑 .git/info/exclude,它永远不会被添加到存储库中。

为什么你不想在你的代码库中使用它?
这个文件应该在那里。

无论如何,你应该使用 assume-unchanged 标志
https://git-scm.com/docs/git-update-index

--[无-]assume-unchanged

When this flag is specified, the object names recorded for the paths are not updated.
Instead, this option sets/unsets the "assume unchanged" bit for the paths.

When the "assume unchanged" bit is on, the user promises not to change the file and allows Git to assume that the working tree file matches what is recorded in the index. If you want to change the working tree file, you need to unset the bit to tell Git. This is sometimes helpful when working with a big project on a filesystem that has very slow lstat(2) system call (e.g. cifs).

Git will fail (gracefully) in case it needs to modify this file in the index e.g. when merging in a commit; thus, in case the assumed-untracked file is changed upstream, you will need to handle the situation manually.