BitBucket is awesome, for unlimited free private repositories, you just can’t go wrong.  In two minutes you can get your website code for any project safely to their repositories, accessible from any where.  Of course, it has its limitations.  Take one instance where last week I committed revisions to ProflicFutility.com, a media-heavy website that sells stock video, images, etc, among other business media and services.  I accidentally forgot to exclude the media, so all these .mp4, video files, and stock photos were uploaded to the repository and exceeded the 2 GB limit for free repos.  On top of that, I also committed a bunch of useless files and folders from the Symfony cache, too.

This is where I usually have a ready-to-go .gitignore file in place in the web root to make sure that doesn’t happen, but I didn’t copy my template .gitignore file in there so I started getting “repository exceeded storage limits” notifications from BitBucket.

Also, in your .gitignore you can get the latest documentation from its built in help function on the command line:  “git help gitignore“.

The best way I found to exclude all files of a certain type is to create a .gitignore file in your web root and use wildcards.

So, to ignore all *.log files in any subfolder, use:

*.log

To ignore all files in a specific subfolder, use the “/**/" path wildcard after the sub folder.  So, perhaps in Symfony you don’t want anything in your app/ cache folders committed to your repo, you’d use:

 /app/*/cache/**/

Remember the paths in .gitignore are all relative to that .gitignore file!