I've just downloaded (not cloned!) CakePHP 2.2.4.
The directory containains a .gitignore
file:
# only the relevant part here
/app/Config
/app/tmp
Now I executed these command because the directories (and their initial contents) Config and tmp would otherwise never been committed:
git add -f Config
git add -f tmp
I have no problems with the tmp directory because no files are changed there, only new files will be created!
In contrast, I had to modify some files (e.g. database configuration) in the Config folder.
But Git now wants me to git add
these modified files again!
How can I ignore these modifications?
I could also reinit the whole Git repo because I didn't created/modified too much.
My modifications to CakePHP for solving the actual problem
My new *.gitignore
file for CakePHP:
# removed: /app/Config/
# start edit
/app/Config/*
!/app/Config/Schema/
!/app/Config/*.default.php
# end edit
/app/tmp
/lib/Cake/Console/Templates/skel/tmp/
/plugins
/vendors
/build
/dist
.DS_Store
/tags
I've also suffixed all files in /app/Config with .default:
acl.ini.default.php.
acl.default.php.
bootstrap.default.php.
core.default.php.
database.php.default --> database.default.php
email.php.default --> database.default.php
Edit: It's better to have *.default.php
than *.php.default
because this prevents outputting the file to the browser if mod_rewrite
fails (though that's very unlikely).