Reputation: 1031
I want to ignore entire public_html/ directory except one file inside
I give .gitignore as below:
public_html/*
!public_html/config/config.php
However, when I run git status , I can not find config.php has been included.
Upvotes: 9
Views: 3570
Reputation: 301587
First commit / add public_html/config/config.php
and then add public_html
to the gitignore.
Upvotes: 2
Reputation: 4631
Change .gitignore to
public_html/*
And force adding config.php into index.
git add -f public_html/config/config.php
Upvotes: 10