LoginSignup
34
41

More than 5 years have passed since last update.

WordPressをGitで管理

Posted at

サイト全体をWordPressで管理することは多いですが、その内容をGitで管理しようとすると

・WordPressのコアファイルも管理対象になり、リポジトリが巨大になる
・管理画面からWordPressをアップデートすると、リポジトリとの内容に差異ができる

という問題があります。
よって自作テーマ部分のみ管理するといいですが、その際の .gitignore の書き方をメモ。

Thumbs.db
.DS_Store

/wp-config.php
/.htaccess
/.htpasswd
/index.php
/license.txt
/readme.html
/wp-*.php
/xmlrpc.php
/wp-admin/*
/wp-content/*
!/wp-content/themes
/wp-content/themes/*
!/wp-content/themes/sample
/wp-includes/*

これで sample テーマのみをGitで管理できます。

もしくはもっと単純に、/wp-content/themes/sample 内がルートフォルダになるようにGit管理するのもアリだと思います。
中小規模のWordPressサイトは、クライアントが管理画面からテーマを編集することも多いので、あまり厳密な管理を目指しても徒労に終わることが多いです。
サイトの規模によっては、テーマのみ適度に緩く管理するほうがスムーズに進められると思います。

34
41
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
34
41