简体   繁体   English

如何忽略所有目录中的.dll文件

[英]How to ignore .dll files from all directories

I have a project and it has a lot of directories containing .dll files. 我有一个项目,它有很多包含.dll文件的目录。 Now I want to ignore all files having .dll extension from all directory. 现在,我想从所有目录中忽略所有扩展名为.dll的文件。 I have .gitignore file in root directory.I tried many combinations but none seems to work. 我在根目录中有.gitignore文件。我尝试了许多组合,但似乎都没有用。

Please help 请帮忙

Ignoring files From time to time, there are files you don't want Git to check in to GitHub. 忽略文件有时,您不希望Git签入GitHub的文件。 There are a few ways to tell Git which files to ignore. 有几种方法可以告诉Git忽略哪些文件。

Create a local .gitignore 创建一个本地.gitignore

If you create a file in your repository named .gitignore , Git uses it to determine which files and directories to ignore, before you make a commit. 如果您在存储库中创建一个名为.gitignore文件,那么在提交之前,Git会使用它来确定要忽略的文件和目录。

A .gitignore file should be committed into your repository, in order to share the ignore rules with any other users that clone the repository. 应该将.gitignore文件提交到您的存储库中,以便与克隆该存储库的任何其他用户共享忽略规则。

GitHub maintains an official list of recommended .gitignore files for many popular operating systems, environments, and languages in the github/gitignore public repository. GitHub在github/gitignore公共存储库中维护了许多流行的操作系统,环境和语言的.gitignore文件的官方推荐列表。

  1. In Terminal, navigate to the location of your Git repository. 在终端中,导航到Git存储库的位置。
  2. Enter touch .gitignore to create a .gitignore file. 输入touch .gitignore创建一个.gitignore文件。

The Octocat has a Gist containing some good rules to add to this file. Octocat的要点包含一些要添加到此文件的良好规则。

If you already have a file checked in, and you want to ignore it, Git will not ignore the file if you add a rule later. 如果您已经签入了文件,并且想忽略它,那么以后再添加规则时,Git将不会忽略该文件。 In those cases, you must untrack the file first, by running the following command in your terminal: 在这种情况下,必须首先通过在终端中运行以下命令来取消跟踪文件:

git rm --cached FILENAME

Create a global .gitignore 创建一个全局.gitignore

You can also create a global .gitignore file , which is a list of rules for ignoring files in every Git repository on your computer. 您还可以创建一个全局.gitignore file ,该.gitignore file是用于忽略计算机上每个Git存储库中文件的规则列表。 For example, you might create the file at ~/.gitignore_globa l and add some rules to it. 例如,您可以在~/.gitignore_globa l处创建文件,并向其中添加一些规则。

  1. Open Terminal. 打开终端。
  2. Run the following command in your terminal: git config --global core.excludesfile ~/.gitignore_global 在终端中运行以下命令: git config --global core.excludesfile ~/.gitignore_global

Just use 只需使用

*.dll

That will ignore all .dll files recursively, in all folders. 这将递归地忽略所有文件夹中的所有.dll文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM