Skip to content

Instantly share code, notes, and snippets.

@datawebbie
Last active December 23, 2015 18:59
Show Gist options
  • Save datawebbie/6679871 to your computer and use it in GitHub Desktop.
Save datawebbie/6679871 to your computer and use it in GitHub Desktop.
Proper framework version upgrade procedure with original author's commit history intact. Follows the git branching model (http://nvie.com/posts/a-successful-git-branching-model/) that I currently use.
Start with cloning the framework's repository (in this example Wordpress) in your local machine.
$ git clone https://github.com/WordPress/WordPress.git
If you get an error like this - "Did you intend to checkout 'tags/xxxxx' which can not be resolved as commit?", fetch new tags.
$ git fetch origin --tags
Create separate branches for the current verion you are using and the version you want to upgrade to.
$ git checkout -b 3.6-branch tags/3.6
$ git checkout -b 3.6.1-branch tags/3.6.1
Checkout the upgrade target branch(if not already on that branch) and create a patch file agains the current version
$ git checkout 3.6.1-branch
$ git format-patch 3.6-branch --stdout > wp-3.6-to-3.6.1.patch
Create a feature branch from your project's master branch
$ cd ../getfree
$ git checkout master
$ git checkout -b wp-upgrade-361
Test and apply the patch to the feature branch, first one shows changes, second one shows any conflicts
Make sure to use --signoff option
$ git apply --stat ../WordPress/wp-3.6-to-3.6.1.patch
$ git apply --check ../WordPress/wp-3.6-to-3.6.1.patch
$ git am --signoff < ../WordPress/wp-3.6-to-3.6.1.patch
Now the feature branch will have all the upgrade changes in it.
$ git push origin wp-upgrade-361
Create a pull request to master and dev branches as required in BitBucket
That's it! Well done!
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment