Wednesday, November 29, 2017

How to exclude all the files except files starting with a name in the Git or GitHub

In the GIT project, I have many .sql files in it related to different databases.
Is there anyway I can exclude all the files except the files starting with “Hive_” in my Git Project.
Is there anyway to do so in .gitignore file.
Through .gitignore I can exclude the files list.
But the current requirement is reverse here, I want to exclude everything except files starting with specific characters.
To do that.
Create a .gitignore file in the root folder of the repository.
The .gitignore contents:
————————————–
# excluded all files
*.*
# except all files prefixed with Hive_
!Hive_*

No comments:

Post a Comment