Monday, June 29, 2009

Save yourself time with Subversion

If you use FTP in your day to day workflow, a switch to subversion can put time back on your calendar. Anytime you save yourself a few minutes by removing manual steps from a task, you've freed up time to do the interesting and fun parts of your job. Here's my workflow with subversion: when I've got changes I want to send to the server, I commit my changes with a single line at my command prompt, or a single right-click in Windows Explorer. Then I switch to another window and update the server with the same single command/right click. Done. My changes have arrived and are live. If I don't need the server to update immediately, I can do a scheduled task or cron job that updates itself once a minute/day/hour. Since I test locally, I only commit when I'm ready for it to go live, so the automated update works well for me. Ever worked with someone on the same file? You change it, FTP it up, then they FTP their own changed copy, and then you do another change, etc etc.? Now who's got what copy where? With FTP, the only solution is to manually overwrite the files once you've sorted out what version you need. With subversion, the logs show you who did what, and when they did it. A quick check of the logs (again, with a single right click or command) and you can see what happened. Need to get back to how things were before? Again, a single command can take you to any point in history to see how it worked, and another command gets you the latest version again. So you can fix the problem and have free time to take care of other tasks*. Web 1.0 was built on FTP. Web 2.0 rocks with subversion**. What web are you working with? * Like administering a beating to the co-worker who overwrote your files. ** To be honest, there are lots of great version control systems (VCS). Subversion, git, mercurial, etc etc. I use subversion b/c it works for me. But any VCS is better than FTP.

4 comments:

Anonymous said...

What is your opinion about leaving comments? In general I have experienced that having to leave a comment with each commit works best. Makes it easier to find changes/causes back in the history. Voluntary comments usually seem to end up in no comments at all after a few weeks/months, which is not really helpful when issues arise.

Patrick said...

I think everyone should be discipline enough to leave comments voluntary, but if it becomes a problem, should be mandatory. Its good to know what and why things are being changed, and it might make people think twice about committing something thats "broken". To me, if it is really about saving time, then spending a few extra moments writing a comment, could save hours. Its a great investment.

Scott Plumlee said...

I think every commit should have a log message. It's got to be enforced by the team getting on each other if there are no messages. Doesn't have to detail every single thing done, but there should be a message, otherwise beatings should commence.

Patrick said...

What if it is just you working on the project? I would think it still would be wise to leave a comment. There often are times when I forget what I did in a commit.