Lately I decided to play with git and WordPress development.
I modified this gist https://gist.github.com/444295 which is the .gitignore for a regular wordpress project.
This is my version:
# Ignore everything in the root except the "wp-content" directory.
# Ignore everything in the "wp-content" directory, except the "plugins"
# and "themes" directories.
# Ignore everything in the "plugins" directory, except the plugins you
# specify (see the commented-out examples for hints on how to do this.)
# Ignore everything in the "themes" directory, except the themes you
# specify (see the commented-out example for a hint on how to do this.)
# Ignore everything in the "uploads" directory, except the wpsc directory
# within the uploads only listen to upgrades and themes
# however within themes folder just listen to hmmujer
The main advantage I rapidly became aware of was that I could implement new features and if I messed up then I could come back to a point where I was absolutely confident on my code. Since it could be a live site, then I can rapidly switch between the current branch and the feature branch to watch how the changes look.
Of course I develop on a local server first, so that is good so I can test results on the browser immediately and branch other features as well.
1. I added two lines of code on the products_page.php for handmademujer site:
2. I come back to master branch
git checkout master, refresh browser and get my site back:
Future Problems (Questions for Phil):
– how to work with upgrades on plugins? and how to do the merge with the latest version with my changes to it? Notice that if I have not updated my plugin for a while it could be like 1552 lines to update. How to manage that complexity with git?
– what to do in case the state of the database needs to be also restored, does git work or have some functionality for keeping also the state of the databases? what could the alternative be?
I feel more secure now to explore other features and isolate independent advances that I can later on merge to make up a better site. We created a better .gitignore file that we can further tailor to work with wordpress, ecommerce or other important plugins that tend to change with time.
You can show appreciation by donating: http://bit.ly/donateforhelp
By donating you will be helping me to help others as yourself.