How to ignore everything except a couple of files in a top-level directory, and everything in multiple directories using .gitignore

I want to ignore everything except a couple of files in a top-level directory, and everything in several directories with .gitignore

My top level .gitignore:

*
! / Application /
! Gbase.php
! Secret List-prices.php

The problem is that I have to put .gitignore with one entry:
! *

in each of the subdirectories that I want to include for its operation. I do not want to include .gitignore in each of the directories I want to include. I want to handle everything at the top level .gitignore.

+3
source share
2 answers

:

/*
!app/
!gbase.php
!list-secret-prices.php

. , , git, .

app. , git (), git - .

+5

gitconfig ($ HOME/.gitconfig)

[]   excludesfile =//meself/.gitignore

~/ .gitignore.

?

0

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


All Articles