首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >使用git在子目录中安装wordpress,但不使用git子模块

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

Stack Overflow用户
提问于 2012-05-09 19:08:40
回答 2查看 532关注 0票数 3

我正在使用git在本地主机上运行wordpress工作流(基于Mark的Wordpress localhost )。我的文件结构如下所示

local.dev

  • .git
  • index.php
  • .htaccess
  • wp-config.php
  • local-config.php (ignored)
  • content/themes/
  • content/plugins/
  • content/uploads/ (ignored)
  • core/ (wordpress核心)

我想要做的是从github获取最新的wordpress,并将其放入核心/以便升级过程看起来像

代码语言:javascript
复制
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拉入local.dev,并将文件移动到核心/手动。

我遗漏了什么?

谢谢

EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-05-11 14:49:14

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

票数 0
EN

Stack Overflow用户

发布于 2012-05-15 13:00:20

解决方案

正如安德鲁建议的那样,答案是使用子树合并。

创建个人Wordpress Repo

我将它用作远程wordpress回购- diff分支,用于diff wordpress版本。

代码语言:javascript
复制
#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 -裸init在web服务器上创建)克隆到它中。然后,我使用子树合并添加wordpress回购。

代码语言:javascript
复制
#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/
票数 3
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/10522574

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档