I'm looking to change my ExpressionEngine development process to integrated GIT for version control.

What is the best place to start?

I work on a PC. I use UniServer for LAMP, Aptana Studio 3 for coding (has GIT integration).

What are the first basic steps I need to put into place?

  • 1
    are you familiar with version control already or just starting to give it a go?
    – mjr
    Commented Nov 26, 2012 at 21:54
  • 1
    My first go....
    – Anna_MediaGirl
    Commented Nov 26, 2012 at 22:08

13 Answers 13


The first place to start is to get a GitHub or a Bitbucket account.

For new users, I'd recommend Bitbucket for their excellent tutorial: https://confluence.atlassian.com/display/BITBUCKET/Bitbucket+101

Follow the tutorial above to setup SSH through Git Bash on your local machine (or setup GitHub's easy-to-pick-up GitHub for Windows if you prefer GitHub) and you should well be on your way.

Also don't forget CodeSchool's free tutorial as well: http://www.codeschool.com/courses/try-git

Lynda.com also has a full course on Git: http://www.lynda.com/Git-tutorials/Git-Essential-Training/100222-2.html

Hope this helps :)


Since you're already familiar with EE, I think step 1 should be to take some time to learn the basics of version control.

There are more good tutorials out there than you can shake a stick at:

And some paid training courses to consider:

When I first started using git, I forced myself to use the command line for a while.

Then once I got familiar enough with the process and terms I started using a git GUI app.

After your initial commit, most of your commits will be in the template files.

If you use snippets heavily, I'd also suggest using an add-on that lets you save snippets as files. Your database is not version controlled, so snippets would have to be edited in the control panel otherwise.

Hope that helps.

  • Thumbs up on command line first. I think I avoided that initially because I had just went from TortoiseSVN to TortoiseGIT (GUI that integrates with Windows shell). Consequently wound up doing all sorts of no-no's because to me it seemed to do what I wanted. Git works remarkably well on Windows with its own kind of bash prompt. You can play around with it as much you want to get the feel for it. Recently started using a Mac and the only reason I've been using apps is to have "everything" right in front of me.
    – notacouch
    Commented Nov 26, 2012 at 22:45

One of the key things to remember with ExpressionEngine and GIT is that not all directories should be version controlled.

The core files, third party plugins and your design of course should be - but version controlling the /images/ and /cache/ directory for example is over the top and is a burden on resources (and frankly a waste of time!).

In the past I have run an install of ExpressionEngine that has been the basis of a boilerplate. I would clone this for each site I built and have the third_party resources and basic channels I constantly use ready to roll in minutes.

I have noticed that the applications on Mac are considerably easier to use than their Windows equivalents. With that said, GitHub's Windows app is quite good.

Instead of GitHub or BitBucket I have used Beanstalk - primarily because it has a neat 'Deploy to FTP' function which speeds up deployment.

I'd be interested to hear the communities best practices in regard to managing one base boilerplate install to keep core files and third_party files up to date across all sites - if indeed that is possible. And if there are any database considerations with this.

  • 7
    Can we get like a community wiki or something going for EE & Git? Example .gitignore files (or as you listed what should be ignored), how people include add-ons (submodules are nice but can be way too complicated for people new to git/version control), options for going from dev to production (using git hooks so all you have to do is push to remote, or leave everything manual?)... I haven't used Git with EE since 1.6.x and back then I was new to Git, only really using it locally. So still unaware of EE-Git nuances, too.
    – notacouch
    Commented Nov 26, 2012 at 22:29
  • I think that is a fantastic idea but I'm not actively using GIT currently. It would be the kick that might get me back onto it...
    – Mutual
    Commented Nov 26, 2012 at 22:34
  • 4
    @notacouch github maintains a list of .gitignore files for different applications/frameworks including both codeigniter and expressionengine that are pretty good. I do agree a good definitive place to go for best practices for using git with EE would be great.
    – UltraBob
    Commented Nov 27, 2012 at 3:38

This series of posts is quite helpful, whether you're PC or Mac:



It would be EXTREMELY nice to have a definitive EE/Git 'guide.' Something that documents 'best practices' and proper workflow. It would be a huge benefit to the community at large.


Having just gotten at least my development site up and running with Git I was looking into how to manage all the different parts of an EE project as sub projects (repositories). I was trying to avoid git submodules like the plague because of my past experience with them (Drupal). If you're new to git you're likely to mess something up there down the line. After much research and playing around I wound up using git submodules as the problem wasn't with this aspect of git itself, but with my misunderstanding of the inner workings of git.

I highly recommend first playing around a little with git to get it to help you achieve a few objectives.

Some of them might include:

  • Managing EE versions.
  • Managing third party add-on versions.
  • Managing "forked" add-ons (e.g. on GitHub you can copy someone's git repository verbatim as if it was one of your own and modify it to your heart's content!)
  • Managing assets/scripts/libraries/whatever shared between sites
  • Flipping between snippet/template code for a development vs. production site.
  • Making a quick fix for production site while working on major changes for development without losing anything
  • Have a history of all the changes you made whether in your templates or add-ons (this is especially great when code you introduced... also introduced bugs)

Simulate an actual need in EE that isn't being fulfilled, use the resources others provided to get from A to B, try to use command line for the commands. Also have a git GUI client handy if just to see the history. (SourceTree was recently released for Windows, I've been using it on the Mac myself it's been great.)

Once you have a feel for it it will help immensely to have a better understanding of the inner workings of Git. For that I highly recommend the following:

This will help you understand the nuances of merging, rebasing, having a balanced history. Some important notes... a branch is not actually some kind of record of your project, a branch is just a 40 byte file. A commit is what actually contains metadata if you will of history. Branches and tags are references to commits, commits that are referred to along with their ancestors are the ones that are kept. You can branch away all you want, it is inexpensive. This will also help you understand fast-forward and non-fast-forward. If the commit already exists (ahead of your current work/branch) and you're merging it into your current branch or whatever, all git has to do is point your branch to that commit (fast-forward). If you want to create a new commit altogether, say, for the sake of showing linear history, you could do git merge --no-ff <commit-ish>.

After studying those two materials (amongst others, but those provided the bulk) I was a lot more comfortable with tackling EE as a super project with EE, add-ons, sites (snippets, templates, stash templates), and assets as submodules. Once you're there, too, you may want to look into these two Q-A's to set up your .gitignore file:

Since you're on Windows you can't use symbolic links to split your add-ons' system vs themes directories. You may want to monitor this thread and see what epocsquadron comes up with:

Personally my site's structure is something like this with heavy usage of symbolic links:


Where ee2 is a repo for EE, sites has repos e.g. like default_site which contains all aspects of EE that are site-specific such as templates and snippets, and assets are other third party stuff that didn't seem to belong anywhere but warrant sharing/versioning.

(On the subject of assets... I also modify my nginx virtual host config for the site to cascade certain urls, e.g. should /images/ belong to ExpressionEngine? A site like default_site? What about /js/ and /css/? For certain folders I don't see why they should have to be in one place, so I figure out which directories share them, have priority, and then use location directives, named location directives with if statements to cascade submodules.)

I haven't had time to look into deployment, continuous integration, etc. My workflow is probably going to be faster with just working in an editor (Coda 2) and uploading from it as I go along.


+1 for Bitbucket & SourceTree

  • SourceTree isn't available for Windows.
    – Tyssen
    Commented Nov 28, 2012 at 1:37
  • 1
    SourceTree was very recently made available for Windows! =)
    – notacouch
    Commented Mar 19, 2013 at 19:22

This is more for once you have Git set up and going, but this article really helped me build out a workable development and deployment workflow using branching. http://nvie.com/posts/a-successful-git-branching-model/

Here are some other resources that helped me get GIT set up that I don't think have been mentioned yet



Besides all the other answers, I like to add a git "hook" that would do a database dump into a directory inside my repo, then perform a "git add", every time I do a commit.

You can achieve this by creating a file named "pre-commit" inside .git/hooks/ and making executable (not sure how to do that on windows machines).

In my mac (using MAMP) I have the following bash script:


/Applications/MAMP/Library/bin/mysqldump -u $DBUSER -p$DBPASS $DB > $SCHEMAPATH/$DB.sql
git add $SCHEMAPATH/$DB.sql
exit 0

Basically, every time I issue a commit, git will run a mysqldump of the DB and stage it before committing. I use this in all my EE projects.


Guess I don't have enough rep yet to post more than 2 links per post so here are another 2 links:


I also like using Beanstalk because of its deploy via FTP feature.


We use this method for deployment. Super easy and a good safety buffer.


Well worth a look.

Good luck with it - It will change your world once you start using it well.


If you don't want to use GitHub, BitBucket or SourceTree you can set up your own repository on your server. I have one on my Linux server.
For information on how to do this go to the git book: http://git-scm.com/book/en/Git-on-the-Server


I'd recommend Masuga's book "The Guide to ExpressionEngine® Development", (http://eeguidebook.com) it walked me through it perfectly, and I had never used git or bitbucket before reading the book :)

I'd start there.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.