web-dev-qa-db-ja.com

WordpressとGit - どのフォルダを追跡すればいいの?

私はWP開発環境と共にGitを設定していますが、何を追跡し、何を無視すべきか疑問に思いました。プラグインを追跡することとWP coreのためにそれが理にかなっているならば。テーマとプラグインの両方に対して1つのリポジトリを作成しますか?

常識では、WPを全体として追跡することは、私がコアの開発や更新に関わっていないので、やり過ぎて無用であることを示唆しているでしょう。もちろん、私の仕事がある場所で私のtheme/child-themeフォルダを追跡したいです。プラグイン?

それで、私は何が提案された設定であるか、いくつのリポジトリがあるか、そして何を追跡/無視するべきか疑問に思います

参考文献:

gitを使用してWPダッシュボードから更新するWP Webサイトプロジェクトを構築する方法

バージョン管理のあるフリーランサーのためのワードプレス開発環境をセットアップするための最良の方法は何ですか?

2
Riccardo

テーマフォルダとカスタムプラグイン以外は基本的に無視してください。サンプル.gitignore:

wp-admin/
wp-includes/
.htaccess
index.php
license.txt
liesmich.html
readme.html
wp-activate.php
wp-blog-header.php
wp-comments-post.php
wp-config.php
wp-config-sample.php
wp-config-stage.php
wp-config-live.php
wp-config-dev.php
wp-config-production.php
wp-cron.php
wp-links-opml.php
wp-load.php
wp-login.php
wp-mail.php
wp-settings.php
wp-signup.php
wp-trackback.php
xmlrpc.php
config/
wp-content/plugins/
wp-content/mu-plugins/
wp-content/languages/
wp-content/uploads/
wp-content/upgrade/
wp-content/themes/*

# don't ignore the theme you're using
!wp-content/themes/yourthemename

これは、ワードプレスとプラグインをインストールするためにcomposerと一緒に使用すると最も理にかなっています。

4
skndstry

これは主観的なものであり、達成しようとしていることによって異なります。テーマ開発者は、プラグイン開発者とは要件が異なる場合があります。これはWordPressインストールのための 最低限の.gitignoreファイルの良い要旨です

# -----------------------------------------------------------------
# .gitignore for WordPress @salcode
# ver 20160309
#
# From the root of your project run
# curl -Ohttps://Gist.githubusercontent.com/salcode/b515f520d3f8207ecd04/raw/.gitignore
# to download this file
#
# By default all files are ignored.  You'll need to whitelist
# any mu-plugins, plugins, or themes you want to include in the repo.
#
# ignore everything in the root except the "wp-content" directory.
/*
!wp-content/

# ignore everything in the "wp-content" directory, except:
# mu-plugins, plugins, and themes directories
wp-content/*
!wp-content/mu-plugins/
!wp-content/plugins/
!wp-content/themes/

# ignore all mu-plugins, plugins, and themes
# unless explicitly whitelisted at the end of this file
wp-content/mu-plugins/*
wp-content/plugins/*
wp-content/themes/*

# ignore all files starting with . or ~
.*
~*

# ignore node dependency directories (used by grunt)
node_modules/

# ignore OS generated files
ehthumbs.db
Thumbs.db

# ignore Editor files
*.sublime-project
*.sublime-workspace
*.komodoproject

# ignore log files and databases
*.log
*.sql
*.sqlite

# ignore compiled files
*.com
*.class
*.dll
*.exe
*.o
*.so

# ignore packaged files
*.7z
*.dmg
*.gz
*.iso
*.jar
*.rar
*.tar
*.Zip

# -------------------------
# BEGIN Whitelisted Files
# -------------------------

# track these files, if they exist
!.gitignore
!.editorconfig
!README.md
!CHANGELOG.md
!composer.json

# track these mu-plugins, plugins, and themes
# add your own entries here
!wp-content/mu-plugins/example-mu-plugin/
!wp-content/plugins/example-plugin/
!wp-content/themes/example-theme/
1
Kenya Sullivan