views:

484

answers:

9

I have absolutely no idea about version control. Only that it can be very useful in many ways.

I have found a few related questions but none that start from the absolute begining.

Can anyone help me with version control in relation to PHP projects (does it matter)?

thank you!

More Info

I am the only developer at my work using Mac OS X and traditionally just been using FTP.

+5  A: 

The type of code is irrelevant.

One open-source and popular version control system is Subversion and there is a very good overview/manual here.

nzpcmad
Thank you - I am looking now.
alex
+2  A: 

Moreover, you can get the Eclipse PDT (PHP Plugin) and use Subclibse in the IDE.

Ian P
Which should make it easier to integrate using subversion into your workflow.
VirtuosiMedia
A: 

Check out other options too - Miscrosoft's TFS (this not only used for source control system but for defect tracking, project management etc etc) , Bazaar, Git are popular ones.

Svet
A: 

Alex, Version control (and some will scathe me for this statement) is not a trivial matter, and even very experienced developers get themselves into trouble. The most frequent causes for frustration are limitations of a particular product (Visual Source Safe is a famous one), and members of a team not following the same process, or not understanding the process at all. This should not stop you from looking into using a source control tool - the opposite is the case. You can only use a tool effectively if you understand what it does and why.

I would recommend that you look into CVS. It has been around for many years, it is relatively simple to install, set up, and use, and while there are GUI clients available for most platforms, learning it from the command line may provide the best access to its features.

cdonner
-1 CVS is widely regarded as deprecated in favour of Subversion which offers a superset of features, is better supported on OP's system and fixes almost all of the egregious problems CVS suffers.
Alabaster Codify
What does CVS offer that SVN doesn't? I've heard this argument before and have yet to hear a compelling argument for CVS.
Ian P
Holy crap, are you serious? Relatively simple compared to what?
Ant P.
It's "simple" because it's so old. However, modern package systems make almost anything else just as simple, perhaps moreso.
staticsan
wow, i agree it may not deserve an upvote for saying CVS instade of SVN or GIT... but i dont see how it wins a downvote, the rest of the post is quite true and good to know....
DFectuoso
He's getting downvoted because it's just bad advice. Nobody should bother with CVS anymore unless they're required to (their company uses it, etc). It's like suggesting that someone look into learning VB6 instead of C# or VB.NET.
Chad Birch
+1  A: 

I use GIT to php development.
It's fast, flexible, reliable, clean (cvs and svn creates a lot of hidden folders that i personally don't like). it's distributed nature allow to work the way you want. (whit or without a central repositorie). You can find more about it here:

Luis Melgratti
Although I don't like GIT, I commend you for not citing "OMG LINUS USES IT!1"
Ian P
@Ian: yeah!!! and LINUS USES IT!!! (sorry i couldn't resist the joke)
Luis Melgratti
A: 

If you're on a Mac, do yourself a favor and pick up Versions, a beautifully designed (and highly functional) Subversion GUI. You'd do best to learn the terminology and get an idea of how Subversion works using a GUI before you jump to the command line. Once you're able to commit revisions of your code and run updates to get other people's work, then go back and read the red bean book (it really is the best way to learn Subversion in-and-out).

http://versionsapp.com/

Typeoneerror
+23  A: 

Yes, try it out, it's worth it. And the language you are using doesn't matter. It's working great with PHP for me and it will for you too.

Benefits

If you are the only developer, it is indeed easier to go without version control. However, you will find great benefits to using a version control system. Some of the easiest benefits will be:

  1. Never wondering what is your latest version once you go back to a project (no more myproject090201-archive2-final6.zip)
  2. Never fear to start off some major refactoring, if you make a mistake on your file, you'll just rollback to the latest version
  3. If something stops working in your project and you have the feeling it worked at one point, you can test some of the prior versions easily and look at the difference between the working version and the non-working version to find what broke the code
  4. Additional backup of your current project, and even better if it's not on your machine... of course, additional points for backing up your version control system, we're never too cautious, you don't want to have to restart that month-long project do you?

Choices

As some have said, you have a few choices for your version control system and I guess you'll want a free one to begin. There are a few excellent commercial products but the free ones have nothing to be ashamed of. So here are some very popular free version control systems:

Centralized versus distributed

Subversion has been there for a while and it's one classified as 'centralized'. Meaning everyone will always go fetch the latest version and commit their latest work to one central system, often on another system although it can easily be on your own machine. It's a process easy to understand.

The three others are called 'distributed'. There's a lot of different possible processes as it's a more flexible system and that's why those three newcomers are getting a lot of traction these days in open source projects where a lot of people are interacting with one another. Basically you are working with your own revisions on your own machine, making as many copies as you need and deciding which versions you share with other people on other computers.

The trend definitely seems go towards distributed system but as those systems are more recent, they are still missing the GUI tools that makes it really user friendly to use and you might sometimes find the documentation to be a bit lighter. On the other hand, this all seems to be getting corrected quickly.

In your case, as you are working alone, it probably won't make a big difference, and although you'll hear very good points for centralized and distributed systems, you'll be able to work with one or the other without any problems.

Tools

If you absolutely need a GUI tool for your Mac, I'd then choose SVN to get initiated to source control. There are two very good products for that (commercial):

And a few other ones (such as the free svnX) that are becoming a little bit old and unfriendly in my opinion but that might be interesting trying anyway.

If you don't mind not using the GUI tools, with the help of Terminal you'll be able to do all the same things with a few simple command lines with any of the aforementioned systems.

Starting points

In any cases, you'll want some starting points.

  • For Subversion, your first stop must be their free book, Version Control with Subversion. Take a few hours of your day to go through the chapters, it'll be time well invested. The introduction chapters are a good read even you don't want to use Subversion specifically because it'll get you to understand version control a little bit better.

  • For a distributed system, I've had fun with Mercurial but it's an easily flammable subject so I'll let you make your own choice there. But if you end up looking at Mercurial, have a look at this blog post, it was an excellent starter for me that'll get you up and running with the basics in a few minutes if you're already a bit accustomed to version control in general. Anyway, drop by Mercurial's homepage and have a look at the Getting Started section of the page.

Conclusion

Give it a go, invest a day trying it out with a few bogus files. Try out renaming files and directory, erasing, moving things around, committing binary files versus text files, resolving conflicts and reverting to older versions to get a hang of it. These are often the first few hurdles you'll encounter when playing with version control and it'll be painless if it's on a non-production project.

In any cases, it's something well-worth learning that'll be helpful with your solo projects as well as if you end up working with other developers at your current job or your next one.

Good luck!

lpfavreau
This is a great answer!!
alex
Thanks, hope it will help and that you'll be playing with source control soon!
lpfavreau
+1 for quantity alone. :)
Paolo Bergantino
+1 Great, in-depth answer.
Saladin Akara
+1  A: 

Versions is working well for another developer I work with. Additionally, if you are using Textmate the SVN bundle provides pretty much all you need for most parts of the Subversion workflow. I really like it.

The Project Plus plugin takes it a step further by adding small unobtrusive badges to versioned files in the project tree, showing at a glance the state of files in a project.

GloryFish
I love me some project plus
Typeoneerror
A: 

use bazaar http://bazaar-vcs.org/

it's very nice and you can start using it in minutes.

JRomio