I am trying to set up git for a WordPress installation and am attempting to write a .gitignore file that will exclude EVERYTHING BUT my child theme folder. Here is what I have so far:
# Ignore everything in the root except the "wp-content" directory.
/*
!.gitignore
!wp-content/
# Ignore everything in the "wp-content" directory, except the "plugins"
# and "themes" directories.
wp-content/*
!wp-content/plugins/
!wp-content/themes/
# Ignore everything in the "plugins" directory, except the plugins you
# specify (see the commented-out examples for hints on how to do this.)
wp-content/plugins/*
# !wp-content/plugins/my-single-file-plugin.php
# !wp-content/plugins/my-directory-plugin/
# Ignore everything in the "themes" directory, except the themes you
# specify (see the commented-out example for a hint on how to do this.)
wp-content/themes/*
!wp-content/themes/my-theme/
This is only showing the child theme folder itself, not the contents. I feel like this can’t be right based on the documentation I’ve seen so far (https://gist.github.com/jdbartlett/444295). Any suggestions?
Simply create a child theme repo or git submodule.