CodeIgniter and GIT: What not to check-in?


CodeIgniter and GIT: What not to check-in?



This is my first attempt with CodeIgniter and I'm trying to figure out how to configure it against a GIT repo. The basic idea here is to avoid checking-in framework files and somehow keep only my work in GIT. What is the default/best practice here. Do people commit entire codeigniter folder into source control? Looking at the default .gitignore file, it doesn't look like they want to exclude framework folders like system and user_guide etc.


.gitignore


system


user_guide



My idea is to keep XAMPP and CodeIgnitor in default location (c:xampp) and keep my code in source code in, say D:My ProjectsNewExcitingWebsite (with models, views and controllers folders therein) and then redirect codeigniter to look towards that folder by setting variables in config files. Is that the correct way to go? If yes, how do I set path for Controllers? There is a variable for views folder that can be set, but none for controllers and models.


c:xampp


D:My ProjectsNewExcitingWebsite


models


views


controllers


Controllers


views





A look at gitignore.io may also provide some hints. The rules there seem rather fine grained so it might be worth checking if any of them cover special cases that one might have missed.
– mmlr
Feb 5 at 21:39





@mmlr: Thanks. Pretty similar to the default .gitignore. This one too is not excluding system and user_guide.
– dotNET
Feb 6 at 3:55


.gitignore


system


user_guide




1 Answer
1



My practice is to track the entire framework except user_guide, application/cache and application/logs.


user_guide


application/cache


application/logs



Tracking system/ is helpful because when CI has updates from they usually amount to simply replacing system/ and its contents. Nice to have commits available should you need to revert to a prior version of CI.


system/


system/



GIT repositories are so light weight it's hardly worth the effort to segregate files as you describe. I have a CI repo that's about six years old containing a huge number of commits representing tens of thousands of changes and multiple versions of CI. The size of the .git folder is about 39MB. That's a trivially small file for a modern computer. Checking out any given branch or reverting a commit happens in seconds.



Regarding CI's file structure. The folders inside application/ (controllers, models, libraries, etc.) more or less require that relationship. The views folder is an exception and can be in a non-standard location. Same with application and system folders. The file index.php can be edited to change where those folders are to be found and even what they are named.


application/


views


application


system


index.php



To change where controllers live you would have to extend (or hack) the CI_Loader class. Not impossible but hardly worth the effort.


controllers


CI_Loader





Thanks DFriend. Sounds about right.
– dotNET
Feb 5 at 15:06






By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Popular posts from this blog

api-platform.com Unable to generate an IRI for the item of type

How to set up datasource with Spring for HikariCP?

Display dokan vendor name on Woocommerce single product pages