我想将几个目录和文件列入白名单:
/app
/config
/db
Gemfile
首选版本控件git
不允许跟踪目录:
# .gitignore:
* # ignore all: suppose I prefer whitelisting
# but not the following things:
!/app/*
!/config/*
!/db/*
!Gemfile
不起作用:git只看到Gemfile
。
您是否碰巧知道是否有任何版本控制软件允许将dirs和文件列入白名单?
修改1
尝试应用https://stackoverflow.com/a/8025106/788700:
# Ignore everything:
*
# Don't ignore directories, so we can recurse into them:
!*/
# Don't ignore these dirs:
!app/*
!config/*
!db/*
# Don't ignore .gitignore and Gemfile:
!.gitignore
!Gemfile
- 不会跟踪app/
,config/
和db/
中的目标。
编辑2:已解决
使用上述答案中的a comment:
# Ignore everything:
*
# Don't ignore directories, so we can recurse into them:
!*/
# Don't ignore these dirs:
!app/*
!app/**/*
!config/*
!config/**/*
!db/*
!db/**/*
# Don't ignore .gitignore and Gemfile:
!.gitignore
!Gemfile
似乎正在发挥作用。
答案 0 :(得分:2)