简体   繁体   中英

.gitignore exclude directories under directory, but not top-level files

I have a folder populated with both files (mostly archives) and non-specific sub-directories (their expansion) and want to ignore the extracted files. Files always extract to a sub-directory.

What should I add to my .gitignore ?

Following this question and its accepted answer , this snippet added to a .gitignore file within the directory in question will do:

*
!/*
*~

This ignores everything recursively from this directory, but not the files contained directly in it, except for files ending in ~ (emacs backups).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM