使用Git在子目录中安装WordPress,但不使用Git子模块

3
我正在使用git(基于Mark Jaquith的Wordpress Local Dev文章)开发本地主机到线上wordpress网站的工作流程。我的文件结构如下:

local.dev

  • .git
  • index.php
  • .htaccess
  • wp-config.php
  • local-config.php (被忽略)
  • content/themes/
  • content/plugins/
  • content/uploads/ (被忽略)
  • core/ (wordpress核心文件)
我想要做的是从github获取最新的wordpress,并将其放在core/目录下,这样升级过程就会变成:
rm -rf wordpress
svn export http:// core.svn.wordpress.org/trunk/ wordpress
git add --all wordpress
git commit -m 'Upgrade WordPress' wordpress
git push origin master

但是我很难想象如何将WordPress放在自己的目录中,而不使用svn或者使用git pull到local.dev并手动移动文件到core/。

我缺少了什么?

谢谢!

2个回答

3

解决方案

正如Andrew所建议的那样,答案是使用子树合并。

创建个人WordPress存储库

我将此用作远程WordPress存储库 - 不同的WordPress版本使用不同的分支。

#Create new repo as the wordpress parent
mkdir wprepo && cd wprepo
git init
touch README
git add .
git commit -m 'initial commit'

#Add the github mirror as a remote repo
git remote add wordpress git://github.com/markjaquith/WordPress.git

#Get the tags
git fetch -t wordpress

#Merge with the required tag
git merge --squash --no-commit -s recursive -X theirs tags/3.3.2
git commit -m '3.3.2'

本地开发

回到我的本地机器上,我创建了一个local.dev/目录,并将远程开发仓库(在Web服务器上使用git --bare init创建)克隆到其中。然后我使用子树合并工具添加了WordPress仓库。

#Create new repo as the wordpress parent
mkdir local.dev && cd local.dev

#Clone remote development repo
git clone ssh://gituser@remote_server_domain.com/home/gituser/gitrepo .

#Merge remote wordpress repo into core/
remote add -f core ssh://gituser@remote_server_domain.com/home/gituser/wprepo
git merge -s ours --no-commit core/master
git read-tree --prefix=core/ -u core/master
git commit -m 'merging wprepo into core/'

#Push changes to the remote dev repo
git push origin master

也许还有更简单的方法(如果您知道,请告诉我),但对我来说这个方法有效。步骤是从下面的来源汇集而来。


来源

  1. http://jon.smajda.com/2011/07/17/wordpress-and-git/

  2. http://joemaller.com/990/a-web-focused-git-workflow/

  3. http://jasonkarns.com/blog/merge-two-git-repositories-into-one/


0

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接