[英]How to gitignore everything except hidden subdir?
I'm using this .gitignore
file for excluding everything in the current dir and subdirs, except the !
我正在使用此.gitignore
文件排除当前目录和子目录中的所有内容,除了!
prefixed entries: 前缀的条目:
*
!.profile
!.vim/snippets
!.vimrc
The .profile
and .vimrc
files are showing up as untracked in git status
but not the .vim/snippets
directory. .profile
和.vimrc
文件在git status
显示为未跟踪,但.vim/snippets
目录中未显示。 Any idea how to include this directory as well? 知道如何也包含此目录吗? I've tried !.vim/snippets/
but it doesn't work either. 我已经尝试过!.vim/snippets/
但是它也不起作用。 Thanks 谢谢
I found a solution that works OK. 我找到了行之有效的解决方案。 One can explicitly say what dirs and files that should be included along the path: 可以明确地说出路径中应包含哪些目录和文件:
*
!.vim
!.vim/snippets
!.vim/snippets/*
!.profile
!.vimrc
So this would include the .vim
dir and the snippets
directory but only the files ( /*
) in the snippets
dir. 因此,这将包括.vim
目录和snippets
目录,但只有文件( /*
中) snippets
目录。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.