Wordpress - Getting Started with Subversion, Git, or similar Version Control System to keep a History of my Files?
I am not sure how much you know about using version control, but I recently switched from SVN to Git and find that to be great!
Though it depends in you live site's server has Git installed (or will let you). I have a Git setup on the live server also, running off a branch called something like
production. Whenever I finish implementing/fixing something locally, I merge it into the
production branch, then SSH into the live site's server and pull in the changes. Beats dragging files over FTP when you never know if you are overwriting changes etc.
I would recommend putting some time in getting acquainted with Git (if you haven't already), I find it much easier and less hassle than SVN when it comes to changing/adding loads of files (and unlike SVN it doesn't put stupid
.svn folders everywhere).
I am on a Mac, so sorry if none of these applies, but I use Coda as a code editor and installed Git through Ports (using Porticus).
If I were to set everything up anew, I would do:
Install Porticus (which will require you to install Ports, but there is information on that page)
Once you have installed Porticus, open it open, search for "git-core" and Install that.
Download and Install GitX 7-5
There is a good guide on setting up a git repo here, but at it's basic: 1. Open Terminal. 2.
cdto where you want your site to reside.
$: mkdir mysite && cd mysite3.
$: git initand thats it! If you add files to this folder then continue to the next step
Once you have set up a GIT repository locally (above article) then if you open that directory in GitX you will be able to commit stuff etc etc.
Setting it all up on the server can be a bit tricky, I have a MediaTemple and a Dreamhost account which both have GIT out of the box. The link in step 5 tells you how to add a remote repo, so you don't have to do that until you want to bring your live site into the equation. I would recommend getting everything working locally first (unlike SVN, GIT doesn't require a remote repository, so you can do everything on your machine for the time being).
I use SVN for version control with everything I do in WordPress development. I actually started this way because I needed SVN for plug-in development ... once I got started there, it was a natural extension to continue using SVN for themes and custom scripts on client sites.
Since plug-ins are already hosted on WordPress' server, I just check out a plug-in directly to the
/wp-content/plugins/ directory of my local WordPress installation (I run WAMP on my development box). Then I make changes to my local copy and, when it's ready for showtime, commit to the repository. It's a smooth process there, no uploading/downloading and instant verification that my changes worked.
Themes are a bit different, particularly when building for a client. I create a local repository (I have an
R partition on my hard drive specifically for this purpose) and check out the empty repository directly to my
/wp-content/themes directory. Then I make changes as needed and develop until it's ready, committing revisions as I go.
When I'm ready to publish the theme to a client's production server, I export the repository, zip it, and use the native Themes >> Add New functionality within WordPress. This works with custom plug-ins (that aren't hosted by WordPress) as well.
Like I said, I use WAMP on my local machine to run a development installation of WordPress. It works perfectly on my box and allows me to run as many instances of WordPress as I need for a particular project.
For SVN, I use Tortoise SVN. It's free, remarkably easy to use, and integrates with the file and command structure of Windows. Updating, committing, and exporting are all simple right-click, select command operations. Using "Export" allows you to send the entire folder (without the annoying
.svn folders) directly to any location of your choice - I frequently export to the desktop. Zipping the folder is also a right-click operation, and WordPress handles the upload.
Manually transferring files can be a hassle, particularly if you keep changing one file but not all of them. If you instead FTP over the entire directory with "overwrite all" selected, it's much easier to replace old files (and you don't have to keep track of which changed and which didn't). It's like the old 5-minute installation WordPress used to have - just replace everything with the new version.
Personally, I think it is a fun exercise to install SVN / GIT and manage it, but if you can swing $15 per month, Beanstalk is worth every penny. They manage the whole server for you. http://beanstalkapp.com/ The FTP deployment tools are awesome. Mine automatically deploys the version to my staging server when I commit for example
Another way to get some personal file versioning is to use drop box. Every time you save a file into your dropbox it tracks the version, and you can restore to any previous version later on.. You and another developer, or group can share a drop box folder. Granted this does not do trunks, merges, etc, but it does make it very easy for a distributed team to work on one website. You just can not really work on the exact same files at once.
We keep our SVN working copy in dropbox, then I commit the files when the time is write. My designers will not commit files or deal with SVN, So this is the comprimise.
I prefer SVN because I do not need all the trunking that GIT is so great for and there are better GUI tools available of SVN.