[英]git ignore all files of a certain type, except those in a specific subfolder
[英]How can I ignore all files except those with a certain extension in git?
我需要忽略所有文件,除了那些以.php
, .css
, .html
或.js
結尾的.php
。
這就是我現在在.gitignore文件中的內容:
*
!.php
!/*.php
!*.php
它確實忽略了所有內容,但只允許根目錄中的.php
文件,同時隱藏所有其余文件。
*
!*/
!*.php
!*.css
!*.html
!*.js
對於那些想要包含位於@jmborr和@Racso等子目錄中的文件擴展名的人
# .gitignore for excluding all but certain files in certain subdirs
*
!*.cfg
!/**/
!certain/subdir/i_want_to_include/*.cfg
當你排除所有內容('*')時,你必須列出白名單文件夾('/ ** /'),然后才能列出白名單文件。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.