Determining Which Folders in craft/storage to Add to .gitignore

There’s a lot going on witin your craft/storage/ folder. Let’s go through it all one-by-one and figure out what, if any, would be missed if it went missing, versus what can safely be .gitignore’d.

craft/storage/backups/ #

Keeping database backups is important, but unless you are planning on keeping everyone’s databases in sync, there’s probably not a whole lot of reason why you’d want to store them in version control.

Verdict: Ignore

craft/storage/rebrand/ #

If you’re running Craft Client or Craft Pro and you’ve uploaded a custom Login Page Logo or Site Icon, this is where those files will be stored. There’s no corresponding database value to worry about either.

Verdict: Don’t ignore

craft/storage/runtime/ #

Everything in this folder can be recreated in a pinch, and much of it is constantly being regenerated anyway. There’s no compelling reason to keep any of it in version control, and there are good reasons not to. In fact, Craft actually creates a .gitignore file within craft/storage/runtime/ for you, telling Git to ignore everything in the folder but itself (the .gitignore file). So you don’t really have to worry about this one.

Verdict: Ignore

craft/storage/userphotos/ #

It might seem like a no-brainer that user photos should get added to version control, but keep in mind that when a user uploads a photo, the file is saved in this folder and its filename is saved to the user’s row in the database’s ‘users’ table. So unless you have a way to keep the databases in sync between servers, there’s not a whole lot of point to sharing these files. You might be better off keeping them out of version control, and just manually FTP’ing this folder over to the new server when you’re first setting it up.

Verdict: Ignore


Summary #

At the end of the day, the only folder that really might be worth putting in version control is craft/storage/rebrand. And that’s assuming you have Craft Client or Craft Pro. Otherwise, you might as well just .gitignore the craft/storage/ folder as a whole, and call it a day.