I have started to use git for my projects, when I create a project it has a config folder containing configuration files:
application/config/config.php
application/config/database.php
application/config/routes.php
When I first commit I want these files (with their defaults) to be committed, so they exist in the repository as the "default" configurations and if I clone to repository I get these files. When I update them to contain my configuration variables (for the version I'm developing on) I don't want them to be updated in the repository, I want them to remain in their default state in the repository.
I have tried first committing them in their default state and then adding them to my .gitignore file, like so:
application/config/*
Now when I commit my configuration files aren't committed (yay!) however the original defaults disappear, the folder application/config/ no longer exists in my repository.
I assume I'm missing something obvious here, but I'm very inexperienced with git.
How can I commit the configuration files on my first commit but never again with them remaining in the repository in their default state?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…