I use git as my primary version control system, and have recently started using git on my CakePHP projects. This is my current .gitignore file:
app/tmp
vendors/
As used in the cakephp git repo, but this causes a bit more work for me when deploying the project to a server, because I have to go in and create all the app/tmp/ sub-directories by hand before they will work correctly. Is there a way to set it up to ignore the contents on these folders, but to still have them under git control so they appear when I clone the repo into the hoted directory?
I also have been having an issue with my git index being reset while I am working on it, which is causing me to have to do a lot more commits than should be necessary, any ideas on that also?
Git stores only files, not directories, so you can for example add a hidden file into that directory and commit it.
As mentioned git only stores files, not directories. By default cake's .gitignore file ignores all contents in the tmp folder to prevent tmp files being added to your repository.
You can (and should) however do this after you create a project:
cd /my/app
git add -f tmp
which will do this:
$ git status
# On branch master
#
# Changes to be committed:
# (use "git rm --cached <file>..." to unstage)
#
# new file: tmp/cache/models/empty
# new file: tmp/cache/persistent/empty
# new file: tmp/cache/views/empty
# new file: tmp/logs/empty
# new file: tmp/sessions/empty
# new file: tmp/tests/empty
As such your tmp folder structure is ready to be committed, but all other files in your tmp dir will (continue to) be ignored.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With