Why are we writing this article?
After about the third or fourth time we had to rebuild our local GIT repositories because we inadvertently unleashed the fury of an inappropriate git command it’s time to write down how to do the core operations needed to setup, test, develop, patch and submit changes to WP-e-Commerce via GITHUB.
We will use our forked repository at git@github.com:JeffPyeBrook/WP-e-Commerce.git as an example. But first some rules
Rule #1: Our repositories’ MASTER will be a copy of the WPEC repository MASTER Rule #2: No local changes to our MASTERs Rule #3: We will update our local MASTERs frequently Rule #4: We will test merge all of our PR requests into a local version of UPSTREAM master named dev-master
Getting ready, clone the WPEC repositories.
Easy enough from your local git shell make a clone of the repository into your local WordPress plugins directory.
git clone git@github.com:JeffPyeBrook/WP-e-Commerce.git WP-e-Commerce
Inside the plugins\WP-e-Commerce directory, we want to point the UPSTREAM to WPEC’s MASTER repository. Change to the directory and add the remote
git add remote upstream git@github.com:wp-e-commerce/WP-e-Commerce.git
Create our development version of the master branch
git checkout -b dev-master
Dev master should also available on GITHUB
git push -u origin dev-master
Frequently we will want to pull into the local MASTER’s all changes from upstream. To do this these commands will work. Doing these at setup will also confirm your configuration is correct.
git checkout master git fetch upstream git rebase upstream/master
Rule #5: We will name feature branches descriptively in a way to associate them with what is being implemented or changed, for example visitor-meta
Rule #6: When we are ready to submit a PR request, we will create a mirror of our feature branch that is based of off UPSTREAM/MASTER and prefix it with pr. For example pr-visitor-meta.