3

I'm working on a localhost to live wordpress workflow using git (based on Mark Jaquith's Wordpress Local Dev post). My file structure looks like this

local.dev

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

What I want to do is to grab the latest wordpress from github and put it in core/ so that the upgrade process would look like

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 

BUT I'm having a hell of a time figuring out how to put Wordpress in its own directory without

  • using svn
  • using git pull into local.dev and moving the files into core/ manually.

What am I missing?

Thanks

2 Answers 2

3

Solution

As Andrew suggested the answer was to use subtree merge.

Creating Personal Wordpress Repo

I use this as the remote wordpress repo - diff branches for diff wordpress versions

#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

Back on my local machine, I created a local.dev/ and cloned my remote development repo (created on web server using git --bare init) into it. Then I used subtree merge to add the 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 

There maybe a much easier way to do this (If you know it please tell me.) but it worked for me. Steps cobbled together from the sources below.


Sources

  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/

Sign up to request clarification or add additional context in comments.

Comments

0

It sounds like you want to use a subtree merge: http://git-scm.com/book/ch6-7.html

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.