【问题标题】:Installing wordpress in a subdirectory using git but without using git submodules使用 git 但不使用 git 子模块在子目录中安装 wordpress
【发布时间】:2012-05-18 08:25:35
【问题描述】:

我正在使用 git(基于 Mark Jaquith 的 Wordpress Local Dev 帖子)在本地主机上工作以实现 wordpress 工作流程。我的文件结构是这样的

local.dev

  • .git
  • index.php
  • .htaccess
  • wp-config.php
  • local-config.php(忽略)
  • 内容/主题/
  • 内容/插件/
  • 内容/上传/(忽略)
  • 核心/(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/ 中。

我错过了什么?

谢谢

【问题讨论】:

    标签: git wordpress subtree


    【解决方案1】:

    解决方案

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

    创建个人 Wordpress 存储库

    我将其用作 远程 wordpress 存储库 - 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 存储库。

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

    【讨论】:

      【解决方案2】:

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

      【讨论】:

        猜你喜欢
        • 1970-01-01
        • 1970-01-01
        • 2012-11-14
        • 1970-01-01
        • 2016-03-24
        • 2021-03-07
        • 2016-11-13
        • 2013-04-07
        • 2017-08-13
        相关资源
        最近更新 更多