使用git在子目录中安装wordpress但不使用git子模块

时间:2012-05-09 19:08:40

标签: git wordpress subtree

我正在使用git(基于Mark Jaquith的Wordpress Local Dev帖子)在localhost上生活wordpress工作流程。我的文件结构如下所示

local.dev

  • 的.git
  • 的index.php
  • 的.htaccess
  • WP-config.php中
  • local-config.php(忽略)
  • 内容/主题/
  • 内容/插件/
  • content / uploads /(忽略)
  • core /(wordpress core)

我想要做的是从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 into local.dev并将文件移动到core / manual中。

我错过了什么?

由于

2 个答案:

答案 0 :(得分:3)

解决方案

安德鲁建议答案是使用子树合并。

创建个人Wordpress回购

我用它作为 远程wordpress repo - diff分支用于diff 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/并克隆了我的远程开发仓库(使用git --bare init在web服务器上创建)。然后我使用子树合并添加wordpress repo。

#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/

答案 1 :(得分:0)

听起来您想要使用子树合并:http://git-scm.com/book/ch6-7.html