iWizard
iWizard

Reputation: 7104

How to exclude all folders except one?

I'm using git for developing sites and there is one thing that keeps bothering me. For sites which are on shared hosting (cpanel) I must create .gitignore in home directory and then in that file put every folder except one, "public_html". Is there any other way that I can exclude every folder in home directory except public_html, dynamic way?

Upvotes: 2

Views: 221

Answers (1)

Lorenzo Marcon
Lorenzo Marcon

Reputation: 8169

Use ! to exclude patterns in your .gitignore file

E.g.:

*/
!public_html

This excludes all directories (even those you will create after) except public_html.

Upvotes: 3

Related Questions