How I keep my local WordPress install up-to-date
I develop WordPress themes professionally and I need to be on the latest version of WordPress all the time. But for several reasons the "Update Now" button on the dashboard won't work locally. And I'm fine with that. Here it is how I keep my local Multisite instance of WordPress up to date.
I have a cloned version of WordPress from Github. When a new version of WordPress is out, all I do is:
-
cd
into the WordPress directory - Pull the latest changes:
git pull origin master
- Switch the the right branch:
git checkout 3.6
- Run
wpdate
Everything is up-to-date now and no other files of my installation is touched. This works seamlessly for me every time.
If you are saying to yourself what in the world is wpdate
, it is just a bash alias that resides on my .bash_aliases
file. Here is the code for it:
function wpdate() {
GIT_WORK_TREE="/home/banago/Public/desk" git checkout -f;
}
Adjust the directory accordingly; it is just where my WordPress install happens to be. And by the way, I'm on Ubuntu.
Written by Baki Goxhaj
Related protips
4 Responses
What I do is to give wordpress is own directory. You can replace or update the folder easily (manually or with git/svn) and it is completely separated of your customized files. In production, it helps avoid annoying ".git" or ".svn" files.
http://codex.wordpress.org/Giving_WordPress_Its_Own_Directory
What you are doing is pretty handy too. But the subdirectory setup was not possible before version 3.5 for Multisite installs and I had this solution work for me before that.
Check out: http://wp-cli.org. With that, you can just cd into the WordPress directory and run wp core update
Believe it works with multi-site as well, but haven't done one of those for a while so don't take my word for it.
Yes, WP-CLI is a tool I still need to get my hands on. I don't know though weather it will work locally. If it runs the default WordPress upgrade functionallity I guess it won't.