git忽略异常不能处理被忽略目录下的多个子目录 [英] git ignore exception not working multiple subdirectories below ignored directory
问题描述
对于gitignore(!fileName.txt)的异常语法不起作用的问题。实例:
web / [Ee] xample。[Ww] eb / [Ss] itecore / *
!web /[Ee]xample.[Ww]eb/[Ss]itecore/[Ss]hell/[Tt]hemes/[Ss]tandard/[Cc]ustom/32x32*
不包含文件夹32x32中的文件。
我必须通过命令行手动添加它们,如下所示:
pre $ g $ git add -f -r web / [Ee] xample。[Ww] eb / [Ss] itecore / [Ss] hell / [Tt ] hemes / [Ss] tandard / [Cc] ustom / 32x32
有没有办法使用在这种情况下使用异常运算符?
重新包含是忽略目录下多个子目录的文件你尝试),不起作用,因为如果排除该文件的父目录,则不可能重新包含文件[ 对于您的示例,它会如下所示: 来源:my related answer 此处。 或者,您可以而是使用放置在文件目录中的.gitignore文件重新包含[更多此处]。根据口味,这可能是更漂亮的解决方案。 I am having an issue where the exception syntax for gitignore (!fileName.txt) is not working when the file is multiple subdirectories below the ignored directory. For instance: does not include the files in the folder 32x32. Is there a way to use the exception operator in a situation like this? Re-including a file that "is multiple subdirectories below the ignored directory" (as you try), does not work because "It is not possible to re-include a file if a parent directory of that file is excluded" [source]. As an ugly-but-working workaround, re-include all parent directories along the path before re-including your desired file, while keeping the files in these parent directories out by re-excluding them. For your example it would like as follows: Source: my related answer here. Alternatively, you could instead use .gitignore files that are placed in the directory of files to re-include [more here]. Depending on taste, this could be the prettier solution. 这篇关于git忽略异常不能处理被忽略目录下的多个子目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
web / [Ee] xample。[Ww] eb / [Ss] itecore / *
!web / [Ee] xample。[Ww] eb / [Ss] itecore / [Ss] hell /
web / [Ee] xample。[Ww] eb / [Ss] itecore / [Ss ] hell / **
!web / [Ee] xample。[Ww] eb / [Ss] itecore / [Ss] hell / [Tt] hemes /
web / [Ee] xample。[Ww ] eb / [ss] itecore / [ss] hell / [tt] hemes / **
!web / [Ee] xample。[Ww] eb / [Ss] itecore / [Ss] hell / [Tt] hemes / [Ss] tandard /
web / [Ee] xample。[Ww] eb / [Ss] itecore / [Ss] hell / [Tt] hemes / [Ss] tandard / **
! web / [Ee] xample [Ww] eb / [Ss] itecore / [Ss] hell / [Tt] hemes / [Ss] tandard / [Cc] ustom /
web / [Ee] xample。[Ww ] eb / [Ss] itecore / [Ss] hell / [Tt] hemes / [Ss] tandard / [Cc] ustom / **
!web / [Ee] xample。[Ww] eb / [Ss] itecore / [SS]地狱/ [Tt的1 H emes / [Ss] tandard / [Cc] ustom / 32x32 *
web/[Ee]xample.[Ww]eb/[Ss]itecore/*
!web/[Ee]xample.[Ww]eb/[Ss]itecore/[Ss]hell/[Tt]hemes/[Ss]tandard/[Cc]ustom/32x32*
I have to manually add them via command line like so:git add -f -r web/[Ee]xample.[Ww]eb/[Ss]itecore/[Ss]hell/[Tt]hemes/[Ss]tandard/[Cc]ustom/32x32
web/[Ee]xample.[Ww]eb/[Ss]itecore/*
!web/[Ee]xample.[Ww]eb/[Ss]itecore/[Ss]hell/
web/[Ee]xample.[Ww]eb/[Ss]itecore/[Ss]hell/**
!web/[Ee]xample.[Ww]eb/[Ss]itecore/[Ss]hell/[Tt]hemes/
web/[Ee]xample.[Ww]eb/[Ss]itecore/[Ss]hell/[Tt]hemes/**
!web/[Ee]xample.[Ww]eb/[Ss]itecore/[Ss]hell/[Tt]hemes/[Ss]tandard/
web/[Ee]xample.[Ww]eb/[Ss]itecore/[Ss]hell/[Tt]hemes/[Ss]tandard/**
!web/[Ee]xample.[Ww]eb/[Ss]itecore/[Ss]hell/[Tt]hemes/[Ss]tandard/[Cc]ustom/
web/[Ee]xample.[Ww]eb/[Ss]itecore/[Ss]hell/[Tt]hemes/[Ss]tandard/[Cc]ustom/**
!web/[Ee]xample.[Ww]eb/[Ss]itecore/[Ss]hell/[Tt]hemes/[Ss]tandard/[Cc]ustom/32x32*