Skip to content

Instantly share code, notes, and snippets.

@grok
Created May 14, 2014 16:46
Show Gist options
  • Select an option

  • Save grok/47e20270ed3819a84706 to your computer and use it in GitHub Desktop.

Select an option

Save grok/47e20270ed3819a84706 to your computer and use it in GitHub Desktop.

Git Workflows

The many combinations for workflows your team can use, will no doubt make it difficult in deciding how to begin working with WordPress within Pantheon. This is intended to provide you a simple workflow for maintaining your WordPress intallation.

As you read through, remember that this is not the "end all be all" solution. This is a guideline intended to give you an immediate path to follow. You can alter, or come up with alternatives down the road.

Assumptions

  • You have created a new website.
  • You are using a WordPress distribution.
  • You have switched your connection mode to Git.
  • You are familiar with Git and terminal commands.

Local Setup

You should have access to a Git URL along the lines of:

ssh://codeserver.dev.[somenumbers]@codeserver.dev.[morenumbers].drush.in:2222/~/repository.git myproject

So we're going to shorten that to:

git clone ssh://reallylongurl:2222/~/repository.git myproject

Upgrading WordPress

There are a few options.

  1. Clone down your Pantheon repository, setup a local environment and run the built in WordPress updater. This is typically done through the administration screen of WordPress.
  2. Clone down your Pantheon repository and run the following commands:

  • cd myproject
  • mv wp-content /tmp
  • mv wp-config.php /tmp
  • rm -vR \.* << Get rid of hidden files.
  • rm -vR * << Get rid of all other files.
  • wget wordpress.org/latest.zip
  • unzip latest.zip
  • mv wordpress/* .
  • rm -vR wordpress
  • rm -vR wp-content
  • mv /tmp/wp-content .
  • mv /tmp/wp-config.php .

Your upgrade should be good now :)

OR Wait for Pantheon to provide you with the upgrade themselves and then merge the commit.

Adding Plugins & Themes

cd myproject

Now that we are in the cloned project, let's add a Theme.

git remote add -f theme [email protected]:username/ourtheme.git

With -f option, git fetch is run immediately after the remote information is set up.

From here on out you can get updates for your theme like this:

  • git fetch theme
  • git subtree pull --prefix wp-content/themes/ourtheme theme --sqaush

Then you can push up to Pantheon!

You can do the exact same thing with a plugin, here's how.

git remote add -f plugin [email protected]:username/ourplugin.git

Then your process will be:

  • git fetch plugin
  • git subtree pull --prefix wp-content/plugins/ourplugin plugin --sqaush
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment