Do not ignore all files in the global .gitignore

Looking at git to ignore the exception , I realized that you can ignore the files in the repository from the global .gitignore file.

Is it possible to somehow override all the rules from the global .gitignore file so that everything in the repository is in it and nothing is ignored? (except ignoring each file separately)

+5
source share
2 answers

Create .gitignore in the repo folder with one rule:

 !* 

This forgets the rules (with ! ) .gitignore all files ( * ) in the main .gitignore .

+16
source

You can.

Create your own .gitignore file with the appropriate rules and place it in the directory where it will be applied. The rules will apply to a directory with local .gitignore and its subdirectories.

+1
source

Source: https://habr.com/ru/post/1205976/


All Articles