Git - 忽略特定文件夹中包含的某些文件 [英] Git - Ignore certain files contained in specific folders

查看:757
本文介绍了Git - 忽略特定文件夹中包含的某些文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用的是msysgit,并且在树中有一个包含许多bin /文件夹的项目树。在项目的根目录中使用.gitignore文件,我需要忽略位于项目树中任何位置的bin /文件夹内的所有.dll文件。我尝试过bin / *。dll,但这不起作用,我认为它只能在项目根目录下的bin /文件夹中工作。

解决方案

刚刚有一个类似的问题,并意识到:文件已被添加并签入混帐。



如何识别差异:Git没有将文件显示为新,而是显示为已修改。这些细节花了我相当长的时间...



如果这是问题,只需简单地将这些文件git rm重新开始。突然,.gitignore开始按预期工作。


I'm using msysgit and have a project tree that contains many bin/ folders in the tree. Using the .gitignore file in the root of the project I need to ignore all .dll files that reside within a bin/ folder anywhere in the project tree. I've tried "bin/*.dll" but that doesn't work, I assume it is only working against the bin/ folder in the root of the project.

解决方案

Just had a similar problem and realized: The files were already added and checked in to git.

How to recognize the difference: Git didn't show the files as "new", but as "modified". This details has cost me quite some time...

If that is the problem, simply "git rm" these files and start over. Suddenly, .gitignore starts to work as expected.

这篇关于Git - 忽略特定文件夹中包含的某些文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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