What will be the most suitable settings in .gitignore file for WordPress project?

When using git with WordPress project, what will be recommended settings for .gitignore file?

Related posts

Leave a Reply

2 comments

  1. This is from GitHub’s help files:

    *.log
    .htaccess
    sitemap.xml
    sitemap.xml.gz
    wp-config.php
    wp-content/advanced-cache.php
    wp-content/backup-db/
    wp-content/backups/
    wp-content/blogs.dir/
    wp-content/cache/
    wp-content/upgrade/
    wp-content/uploads/
    wp-content/wp-cache-config.php
    
  2. Posting this as an answer because it seems I can’t comment on answers.

    I suggest the following (based on Dales answer):

    .htaccess
    wp-config.php
    wp-content/*
    !wp-content/themes/
    !wp-content/plugins/
    sitemap.xml
    *.log
    sitemap.xml
    sitemap.xml.gz
    

    What it does is that it first ignores everything within wp-content but then makes exceptions for the wp-content/themes/ and wp-content/plugins/ folders.