简体   繁体   中英

Git to ignore all files except certain files

I want git to keep track certain files only, so i wrote this gitignore file. In this file i tell git to ignore all the files except .ps1,.bat,.sql and .tab.I placed this gitignore file in root local working directory. Now the problem was, if the keep track files in subdirectory (BatchFile subdirectory), git will ignore them which i believed due to * . How to correct it ?

*
!*.ps1
!*.bat
!*.sql
!*.tab

My folder directory structure

Main
    BatchFile
    DB_Objects
              Table
              View
              and etc.. 

如果您不希望忽略模式应用于所有子目录,而仅应用于目录.gitignore则在它们.gitignore加一个斜杠,如!/*.bat

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