I'm using git to manage an extended CodeIgniter Framework. It's a clone of the current CI release with extra helpers, libraries ect.
I have many sites all using this framework and if I add a new helper method or fix a bug in one site I want to be able to easily update all the other sites without overwriting any of their custom files.
I wish to achieve the following workflow
- Create a new site directory
git init
to initialise a blank local git repo - Link this with the remote framework repo
git remote add origin [email protected]:username/framework_repo
- Pull a fresh copy of the remote framework
git pull origin master
- Make changes to site files and commit them back to the remote repo
git push origin master
- Pull these changes down to the other sites
- Repeat steps 4 & 5
Thats all fine, BUT:
- Files like config.php and database.php should never be committed back to the remote repo as they are unique to each site.
- However I want them to exist in the remote repo so on the first pull request the default files are downloaded to my local directory.
- Further more if I do another pull from the remote repo to update the framework I do not want these files to be overwritten
Whats the best way to achieve this? Some .gitignore voodoo? I already use .gitignore to ignore files, but in this case its slightly different as I want to pull the file only on the first request.
I hope that makes sense.