将gitignore添加到gitignore [英] Add .gitignore to gitignore

查看:311
本文介绍了将gitignore添加到gitignore的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将 .gitignore 文件添加到 .gitignore 本身?

Is it possible to add the .gitignore file to .gitignore itself?

.gitignore

t工作尽管

我不想在编辑的文件中看到它

I don't want to see it in edited files

推荐答案

.gitignore 文件是为了防止每个在项目上协作的人在项目中包含一些常用文件,例如生成的缓存文件。因此,您不应忽略 .gitignore ,因为它的目的是包含在回购中。

The .gitignore file is to prevent everyone who collaborates on a project to include some common files in a project, such as generated cache files. Therefore you should not ignore .gitignore, because it's purpose is to be included in the repo.

如果您想要忽略只有一个回购中的文件,但不提交忽略列表,您可以将它们添加到该回购中的 .git / info / exclude

If you want to ignore files in just one repo but without committing the ignore list you can add them to .git/info/exclude in that repo.

如果您想忽略机器上每个回购的一些文件,您可以创建文件〜/ .gitignore_global ,然后运行

If you want to ignore some files on every repo on your machine you can create the file ~/.gitignore_global and then run

git config --global core.excludesfile ~/.gitignore_global

这篇关于将gitignore添加到gitignore的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆