推薦目錄架構結構:php
/opts/mysite/
—/wordpress/
—/wp-config.php
—/index.phpgit
*wordpress 要加入到 .gitignore 中,/mysite/index.php 須要修改加載 wordpress 的路徑github
-場景 I
若是網站目錄 mysite 是一個 repo(好比有 mysite/.git 目錄)
-場景 II
網站目錄不是 repo ,而是部署爲 detached worktree,即不存在 mysite/.gitapache
把 wordpress 當成 git submodule 加入到 repo 中。
http://blog.g-design.net/post/60019471157/managing-and-deploying-wordpress-with-git架構
此時能夠把 wordpress 子目錄設置成 git repo(即存在 mysite/wordpress/.git 目錄)git clone git://github.com/wordpress/wordpress.git /opts/mysite/wordpress
wordpress
*注意在 apache 中屏蔽 .git 目錄post
而後經過如下命令升級 wordpress 內核便可fetch
git fetch --tags sudo git checkout tags/4.1.1 -f
wordpress 子目錄也配置成 detached worktree網站
直接下載最新 wordpressgit clone git://github.com/wordpress/wordpress.git /tmp/wordpress
.net
使用 git checkout
命令更新
git fetch --tags sudo git —git-dir=/tmp/wordpress/.git —work-tree=/opts/mysite/wordpress checkout tags/4.1.1 -f