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 :slight_smile:

  • PC
    • WPMU DEV Initiate


    Greetings and thanks for posting on the forums.

    Personally I don’t know how to use GIT to be true :slight_frown: however I know some one who can give a great direction on this issue while I do my research for any future questions on GIT

    I have tagged my colleague @aristath on this thread and he should be here sooner than later.

    In the meantime, I found this thread here: which you might find helpful :slight_smile:



    Sales &Support

  • aristath
    • Recruit

    Hello there @blogjunkie!

    First of all, in order to use Git with WordPress you MUST be using a VPS or Dedicated server so that you have ssh access to it.

    It’s basically pretty simple… I’ll just describe the steps quickly. If you need any further details just post back here and I’ll be glad to help out.

    1. First, find a good and reliable git service. I personally prefer Github, but Gitorious and BitBucket are also great options. If you have any premium plugins and/or themes in your WordPress installation, then please make sure that you use a private repository (usually you have to pay for that, but I believe that BitBucket has private repos for free).

    2. Create a new empty repository.

    3. Using ssh login to your server and go to the folder where WordPress is installed.

    If this is going to be on a public repository, create a .ignore file and add your wp-config.php file in that list so that your database name, username and password will not be public (for security reasons). You can find more details on how to do that here:

    It would also be advisable to add the wp-content/uploads and wp-content/blogs.dir directories in the .gitignore file, so that you don’t upload all the images etc every time you commit something. But I guess that’s just a metter of personal preference and depends on your use-case.

    4. Next, from your terminal do the following:

    git add -A
    git commit -m "initial commit"
    git remote add origin
    git push -u origin master

    Of course replace with your actual repo.

    This will commit and push all your code to the repository.

    That’s basically it…

    Next time you update a plugin, simply login to your server via ssh, go to your wordpress folder and do this:

    git add -a && git commit -a -m "this is the commit message" && git push origin master

    That’s just 3 commands in 1 line. Easier and faster to do. :slight_smile: With that command you add everything, commit it with the “this is the commit message” message (you should personalize that depending on what you’re actually commiting) and then push it to the remote server.

    I would advise against bulk-updating plugins, themes etc. Instead do them one by one and each time do a commit. This way you can simply roll-back if something goes wrong.

    I hope that helps!

    I’ll be marking this issue as resolved for now.

    If however you need any further assistance on this issue, don’t hesitate to reopen this and post an update on your current status!



Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.