问题
I'm using this .gitignore file for excluding everything in the current dir and subdirs, except the ! 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. Any idea how to include this directory as well? I've tried !.vim/snippets/ but it doesn't work either. Thanks
回答1:
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.
来源:https://stackoverflow.com/questions/11633974/how-to-gitignore-everything-except-hidden-subdir