2

Possible Duplicate:
Git - Whitelisting files in a complex directory structure

I have a project called Basic PHP Framework - alpha and it have some files on root dir.

When I need to apply the FW in some project, I just need to use dirs basic (or file basic.phar), application and files index.php and .htaccess. All other files are for debug purposes.

Here start the "good thing": I want work on projects based on this FW with Git version-control, because sometimes I need do a emergency change on this files and, currently, I need EVERYTIME copy manually to project dir (/basic) and sync. It's so annoying. The same if I need update project using git.

My idea is something like sync GIT using specific directories and ignoring all others that not interest me, on each project.

It's possible, currently?

I'm new here, and I don't know if here is the right place to post this kind of question. Feel free to move to another "stack-place".

Community
  • 1
  • 1
David Rodrigues
  • 12,041
  • 16
  • 62
  • 90
  • Possible duplicate: http://stackoverflow.com/q/9162919/321973 (I know it's newer, but the answer there is actually correct"er") – Tobias Kienzler Oct 09 '12 at 07:25

1 Answers1

2

You could add a .gitignore file in the project directory to blacklist/whitelist any file you don't want git to bother tracker, e.g.:

*
# ignore every file by default
!.htaccess
# but don't ignore .htaccess
!basic
!basic/*
!basic/*/*
# don't ignore the 'basic' directory (and 2 levels below)
!index.php
# etc.

(It's easier to setup a blacklist if "All other files for debug purposes" have some common pattern.)

kennytm
  • 510,854
  • 105
  • 1,084
  • 1,005
  • You may have to whitelist `!*/` as well if you got a nested structure, as [shown here](http://stackoverflow.com/a/9227991/321973) – Tobias Kienzler Oct 09 '12 at 07:24