Using git with a CMS for version control and deployment

Hi,

I’ve seen lots of articles to do with using git to deploy websites and it all looks great. I just have no idea how to apply any of that in practice.

We build all of our sites in a CMS (the actual one we use is Contao, but it could be any database backed CMS) and I can’t figure out how I can use git to deploy my project.

Whilst things like page creation happen within the CMS and can’t be tracked by git, i’d still like to use git for the code. This can include things like template files, js files, sass, custom PHP modules etc.

Here is my current workflow (which I am aware is far from ideal):

  • I develop sites locally, using a local Apache and MySql server. I use Foundation SASS + Compass for my CSS.
  • When development is complete I export the local DB & import it into the remote DB. Then I update the DB credentials and upload the entire site via SFTP.
  • If I need to make any changes to code from this point i’ll work on my local files, using Sublime SFTP to ‘Upload on save’ as I work and keep the remote version in sync.

In this situation i’m not working as part of a team, i’m the only one who is going to be working with the code.

How can I move away from this workflow to a git based workflow? Would it be more or less the same with the exception that instead of ‘Upload on save’ i’d push the changes to git, which would then get transferred to the site automatically?

I’ve been looking to move to git for quite a while now so any help would be appreciated.

Thanks,
Jamie