.gitignore文件在忽略一些我们不想控制的文件时非常有用。不幸的是,当文件已经受版本控制时,它不能使用。例如,我的.gitignore(已经添加到git中)文件可能与我的同事想要的文件不同(例如,我想忽略Vim文件)。每当我对这个文件进行更改时,git都会将其显示为修改后的文件。所以我的问题:
如果要排除特定于进程的文件(如Vim临时文件),请编辑(本地)文件 .git / info / exclude 和在那里添加排除模式。此文件专为特定于开发人员的排除而设计,而不是 .gitignore ,该文件专为项目范围的排除项目而设计。
简短的总结是,每个人都应该对添加到 .gitignore 的内容达成一致。对于您不同意的文件,请使用 .git / info / exclude 。
The .gitignore file is very useful in ignoring some of the files that we don't want to control. Unfortunately, it cannot be used when the file is already under version control. For example, my .gitignore (which is already added to git) file might be different than what my coworker wants it to be (e.g. I want to ignore Vim files). Whenever I make changes to this file, git shows it as a modified file. So my questions:
解决方案
If you want to exclude files that are specific to your process (such as Vim temporary files), edit the (local) file .git/info/exclude and add your exclusion patterns there. This file is designed for developer-specific exclusions rather than .gitignore, which is designed for project-wide exclusions.
The short summary is, everybody should agree on what is added to .gitignore. For files where you don't agree, use .git/info/exclude.
更多推荐
Git:忽略版本控制的文件
发布评论