您何时使用.git / info / exclude代替.gitignore来排除文件? [英] When would you use .git/info/exclude instead of .gitignore to exclude files?

查看:95
本文介绍了您何时使用.git / info / exclude代替.gitignore来排除文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我对使用 .git / info / exclude .gitignore 的优点和缺点有点困惑。以排除文件。



它们都在存储库/项目的级别,所以它们有什么不同,我们应该在什么时候使用 .git / info / exclude

解决方案

.gitignore 是它可以检入到存储库本身,不像 .git / info / exclude 。另一个优点是可以有多个 .gitignore 文件,每个目录/子目录内有一个用于目录特定忽略规则,与 .git / info / exclude不同



因此, .gitignore 可在资源库的所有克隆中使用。因此,在大型团队中,所有人都忽略相同类型的文件。例如 *。db *。log
由于多个 .gitignore ,您可以有更具体的忽略规则。



.git / info / exclude 仅适用于单个克隆,因此某人在克隆中忽略的内容在其他人的克隆中不可用。例如,如果有人使用 Eclipse 进行开发,那么开发人员可以将 .build 文件夹添加到 .git / info / exclude ,因为其他开发人员可能不会使用Eclipse。



通常,文件/忽略规则要被普遍忽略,应该放在 .gitignore 中,否则你只想在本地克隆上忽略的文件应该放到 .git / info /排除


I am a bit confused about the pros and cons of using .git/info/exclude and .gitignore to exclude files.

Both of them are at the level of the repository/project, so how do they differ and when should we use .git/info/exclude ?

解决方案

The advantage of .gitignore is that it can be checked into the repository itself, unlike .git/info/exclude. Another advantage is that you can have multiple .gitignore files, one inside each directory/subdirectory for directory specific ignore rules, unlike .git/info/exclude.

So, .gitignore is available across all clones of the repository. Therefore, in large teams all people are ignoring the same kind of files Example *.db, *.log. And you can have more specific ignore rules because of multiple .gitignore.

.git/info/exclude is available for individual clones only, hence what one person ignores in his clone is not available in some other person's clone. For example, if someone uses Eclipse for development it may make sense for that developer to add .build folder to .git/info/exclude because other devs may not be using Eclipse.

In general, files/ignore rules that have to be universally ignored should go in .gitignore, and otherwise files that you want to ignore only on your local clone should go into .git/info/exclude

这篇关于您何时使用.git / info / exclude代替.gitignore来排除文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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