views:

415

answers:

1

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?

+3  A: 

Git stores only files, not directories, so you can for example add a hidden file into that directory and commit it.

  1. Remove app/tmp/ from .gitignore
  2. touch app/tmp/.keep
  3. git add app/tmp/.keep
  4. git commit
  5. Add app/tmp/ to .gitignore
Esko Luontola
Ok yea that is what I used to do, I just could not remember how to do it.
trobrock