I only just started trying to use GitHub with WordPress, so I'm completely new to everything git.

My problem is simple: I want to setup my .gitignore so git ignores absolutely everything except my Wordpress theme which is located at a custom directory '/goods/themes/my-wordpress-theme'.

I've tried a variety of .gitignore files such similar to the following and nothing works.

# Ignore everything

# Except 'my-wordpress-theme'

I'm running Ubuntu with git version 2.7.4

Please help! Thanks, Asher.

  • 1
    Just make that theme the git root, and don't even include upper directories.
    – fuxia
    Nov 14, 2016 at 5:53

1 Answer 1


Run ignore on your themes directory and check out your themes to their individual directories. That will keep your theme segmented just as your WordPress environment. There is no sense in checking out a root git for a single theme.

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.