9

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.

skargor
  • 1,011
  • 3
  • 15
  • 21
  • Similar to this post? Seems to be a problem on windows: http://stackoverflow.com/questions/3667986/git-ignore-exception-not-working-as-desired – vsekhar May 17 '11 at 02:59

2 Answers2

10

Change .gitignore to

public_html/*

And force adding config.php into index.

git add -f public_html/config/config.php
Timofey Stolbov
  • 4,501
  • 3
  • 40
  • 45
2

First commit / add public_html/config/config.php and then add public_html to the gitignore.

manojlds
  • 290,304
  • 63
  • 469
  • 417