Workflow for working with git and WordPress

As my site becomes more important to my business, I want to have better version control so I can look up past changes and backup my code. I keep seeing people talking about having their entire site in git and I want to know how that works.

I currently have my custom theme in my git repo. The only person who will edit the theme is me. After committing my edits, I deploy by FTP-ing the new files to my site.

How would you have an entire site in git? WordPress, themes, and plugins (I have lots of them!) are updated frequently and would create lots of commits. Do I ignore them? Or do I only commit them when I deploy? How would I keep track of changes to my own theme and custom plugins among all the other commits from updated plugins?

I would love for someone to share some insight into this with me.

P.S. As you might guess I’m fairly new to git, hence the wrong terminology etc. Appreciate it if you explain it like I’m 5 with your answers 🙂

1 Answer
1

The problem with the linked article in your question is that it is suggesting to download WordPress and then create your own git repo – but then this cannot be easily updated. Instead you can have WordPress itself in git. Rather than the default subversion, there is an offical Github repository of WordPress, and in the same fashion as with subversion tags you just want to clone the latest branch.

Personally I manage things through subversion (but the principles can be converted to Git):

  • I have a subversion checkout of the current WordPress tag on the server and on my local machine.
  • Follow the WordPress guide on tracking stable versions
  • Plugins are not under source control – I don’t really see the benefit if you’re not modifying the plugins yourself and its easier to just let WordPress handle those
  • My theme is under subversion source control
  • It is perfectly possible in subversion to have one repository inside another then you can update the core independently from the theme

Leave a Comment