I have been a long time fan of using CodeIgniter as a basic PHP framework. While recently Laravel has really won me over because of sheer power and flexibility, I still do have a soft spot in my heart for CodeIgniter which is still a framework of choice for smaller projects that don’t need the extra bloat which Laravel undeniably brings.

When working with CodeIgniter, I always use version control, and my version control of choice is Git. When working on version control it is important that not all your files make it into your repository. You avoid certain files from being added to your repository in Git by adding a hidden file (its a normal file, but uses a ‘.’ (period) at the beginning so it is often hidden by normal file explorers) called .gitignore.

This is the .gitignore that i have created for my own personal projects using CodeIgniter.

https://gist.github.com/jacurtis/ca78f0cb8bfd482a1819

You can see I have broken it up to make it as awesome as possible for you. Basically the first section is all the codeigniter files that you don’t want to track. The config/development folder is all of you development variables like your database credentials which you don’t want to have floating around on github. Next are the log files, those are for you only and don’t need to be shared. Next we have the caching files, which again are for local use only and don’t need to be shared.

The next section is for .codekit files. I used a program called CodeKit to minify javascript, convert SASS and Compass files, and to run code suggestions. Its an awesome tool for mac, if you don’t have this program you could skip this section. This file is basically the configuration file for your codekit project. If you did share it onto github and someone else downloaded your code, they would be able to use the same implimenation as you have. I don’t find this necessary, so i block it.

Last we have our SASS files. We don’t need to share our caching again, and also our configuration file for compass. Lastly is the mac stuff. If you develop on Mac, there is a hidden file in every folder on your Mac called DS_Store. This is equivalent to thumbs.db on windows but used for Linux OSes instead. It is completely un-needed, does not need to be shared, so don’t bother.

[Tweet “Just found the best .gitignore file for CodeIgniter 2 framework”]

I hope that helps. Please tell me what you would add and remove from this in the comments. Also, if you are working on any codeigniter projects, please tell me about them, I love to help or see what you are working on.