5

I just started off building a new site by customizing an existing theme. Now I'm wondering whether there is any advantage of using a child theme instead of a plain git to make my changes upstream-update-proof?

My strategy would be to host from branch let's say my-changes. Whenever there is an update to the original theme I'd switch back to master, update and then rebase my-changes on master.

Like that I could fiddle with everything, even plugins, without having to worry about keeping the right files, e.g. a custom footer.php, in my child theme.

Am I overlooking some advantages of child themes here?

1
  • Are you working alone on your project?
    – prosti
    Commented Dec 23, 2016 at 19:24

2 Answers 2

3

While I know version control approach to be used in practice, I don't think it's too common. WP has weak version control practices in general, so development of extensions doesn't quite plan for such.

Example of specific scenario which will cause issues might be changes in template hierarchy. Let's say you customized single.php in version control. Then upstream theme rearranged things and got rid of single.php altogether in favor of more generic singular.php. Suddenly your changes hang in the air without template to apply them to, essentially your merge is blocked and you have to re-develop your changes on top of a new situation.

With child theme your template will stay in place and continue to work, although occasional updates will be required in some cases as well.

In a nutshell I would consider version control to be essentially a fork to maintain, while child theme would be a downstream extension (under your full control) with upstream dependency.

In my subjective opinion maintaining a fork would be harder on resources in most cases. I would reserve it to solutions which cannot be achieved with a child theme.

1
  • 1
    That's a good point. Even if the functions are just rearranged inside a file it could become challenging for a merge tool like meld.
    – bleutner
    Commented Dec 20, 2016 at 18:36
1

If you plan to sell your theme later, I would go with the git. It is up to you how you will organize yourself to work with the git.

What I know creating new branches in git is a breeze, and you should create them often because branches are resource friendly.

Every tutorial, I watched said feel free to create new branches.

If you compare the child theme vs. the parent theme... I would ask you what do you think is a bit faster?

In general, the answer is obvious since the child theme also executes the parent theme files.

I would go with the parent theme and with creating the branches often.

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.