Properly work in a duo using GIT - php

Me and a friend of mine are starting a project with CodeIgniter. We have never worked in teams before and therefore are very new to this whole VCS thing. I've read a lot of good things about Git since it's decentralized.
Since it's just the two of us, the checkin-checkout process is not a HUGE deal but we would like to keep it professional for further growth. The problem is that we are both very lost on how to use git. Git's documentation is just too much to handle at this point.
So how would we set this up? I assume we develop on our local machines and run it on a local LAMP/WAMP server. If the result is good we push it to the central server right?
Also how do I get the edited files from my partner? Do I have to manually download those or does git do that (or is there another/better way)? (This part is very important since we are developing really quickly now and a lot of things are changing.)
I am working on NetBeans and I can persuade him to do so as well if necessary.

Git is really easy to learn, I recommend these tutorials from BitBucket (I learnt from there myself), it will take no more than an hour.
https://confluence.atlassian.com/display/BITBUCKET/
Git works by commiting files to a repository, and you can pull files from that if there's a change. The tutorials will explain it all and how to set it up :-).

Git is powerful and how much you get back is proportional to how much you spend time learning it. :-) It does take some effort to learn about git. Remember it is neither perforce nor SVN.
One of the best tutorials for quick start I will recommend http://www.vogella.com/articles/Git/article.html
For eclipse you can use EGit plugin. I am sure there is similar one for NetBeans.
About your question on central server, perhaps you can start with http://bitbucket.org which allows you to host free private repository (as long as there are no more than 5 folks using the same repository, then you will have to pay)

Related

Making php development more robust

I've spent some time now developing a web application in php. It has mostly been just for the fun of learning as a side project, but the app now has a few users which I don't want to upset by breaking things as I develop.
At the moment, I have a very rudimentary method for managing the development - I use a text editor (ultraedit) to write the code and use its built in ftp to upload the files to the server. In terms of version control I have 2 domains, and only push files to the "live" domain when they work, but that's it. The domains are hosted on a cPanel shared hosting site which I have some doubts about its ability to handle even minor spikes in traffic. I looked at slicehost yesterday for something more scalable but that looks like a bit of a learning curve from where I am now.
I know I could do better than this, but where to start? I think I need advice on three things
1 - code writing tool
2 - version control / management
3 - scalable hosting
I've deliberately asked these in the same question as I'd like to know if one choice impacts another. Is there a good integrated solution?
Thanks in advance as ever.
Each part of your question has been answered before. The list below lists some of the common tools to use and links to appropriate searches on StackOverflow. There is no all in one package and going into details about these tools in one question is out of scope, so I am afraid you have to do some digging:
SVN, Git or Mercurial
UnitTesting (PHPUnit or SimpleTest)
Continuous Integration
Phing (for deployment)
phpqatools.org
Netbeans or Eclipse (for an IDE)
Disclaimer: list is not meant to be complete and order is not important
There is a lot going on here. I'll give you my two cents though.
I used to use ultra edit. Now I use netbeans, its a fully integrated development environment and it makes my life soooo much easier. Its free too. I can't imagine ever going back to UltraEdit. Also, which brings me to number two, netbeans has SVN and CVS integration
I would use subversion for version control. In my experience it does everything you need for version control. Others use ones like git and mercurial, but I think SVN is widely supported and easy enough to set up. As far as pushing code to the server, i've begun using svn for this too. I first ssh into the server and checkout the code into the public_html directory, and then set up an alias to do svn updates through the command line... its way easier than ftping in my opinion. There are other deployment methods, but i've never used them. see this question:
What is your preferred php deployment strategy?
obviously shared hosting is not going to handle traffic as well as a dedicated server. But there are lots of things you can do to improve performance before moving to a dedicated server. Check out this article: http://developer.yahoo.com/performance/rules.html
It seems that you're after a robust deployment strategy as opposed to a development one. But, correct me if I'm wrong.
In terms of 'code writing tool', and
IDE choice is a subjective
discussion. Feel free to work with
the one you are most comfortable
with, for me this is Netbeans.
As for a deployment strategy, I think it was best summed up in this answer.
Your point about scalable hosting is fairly broad. We will need much better forcasted metrics to give better advice. However, for now, if scalable hosting is a worry then maybe look into some sort of Cloud Hosting.
Have you looked at using wamp/xamp/mamp/lamp for development locally? Uploading via ftp for every change is a pain.
You could do that for local and see that everything works, then push it to your test domain and run through it again and then finally push live.
Might want to look at something like SpringLoops for doing your version control - this has the advantage of doing the deploy and then if it goes pear shaped you can revert it (free account gets 3 deploys a day).
I wouldn't worry about scaleable hosting just now, just focus on the site and the coding, you've only got a few users - wait till it starts becoming a problem before moving (however, I suggest looking into options) but don't try and get all cloud ready - might not ever be a problem.
ps, go with Linode over Slicehost.
I think use Aptana Studio ( http://www.aptana.org ). It is an Eclipse based IDE with all the tools you need integrated in it. It has integrated PHP development tools, GIT or SVN for version control.
I've used shared hosting as well. Once an other site on the same server had DoS atacks and my site became unreachable as well. Otherwise it could work in reasonable speed after some optimization. It served 1000-3000 users per day.
Dedicated servers are much better. Or you can use Amazon web services. I know they are more expensive.
1 - code writing tool
Zend Studio. I would recommend Linux as well if you are going to use linux servers.
2 - version control / management
SVN + phing (if you are going to build serious applications).
3 - scalable hosting
Amazon or RackSpace.
For your editor, just use what you are comfortable and productive with. You most definitely should have version control in place. You never know when you need to rollback a version or two.
I always keep at least 3 versions on the production server. I use symlinks to point the web server at the latest version. If there is a problem, you just need to recreate the symlink to point to an older version.
As for shared hosting, you'd be surprised out how much bandwidth you can get. I have a $10/month shared host that gets about 500K page views a month. Generally, it's not that your shared host can't handle the load, it's that the hosting provider puts too many "shares" on the same server. So it depends on how much resources everyone else on the same server is using. If you are having issues, you can always ask to be moved to a different server.

Version control for PHP Development [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
We don’t allow questions seeking recommendations for books, tools, software libraries, and more. You can edit the question so it can be answered with facts and citations.
Closed 3 years ago.
Improve this question
I have been hearing a lot about the advantages of using a version control system and would like to try one. I was doing freelance web development in PHP for the past 2 years, two months back I hired two more programmer to help me. I will be hiring one more person soon. We maintain 4 websites, all of which are my own, which are continuously being edited by one of us. I learned PHP by myself and have never worked in any other firms. Hence I am new to version control, unit testing and all.
Currently, we have development servers on our workstations. When we edit a particular section of a site, we download the code for that particular section (say /news/ or /movies/ or /wallpapers/ ) from the production server to the dev server, makes the changes locally and uploads to the production server (no code review / testing). Because of this, our dev server is always out of date from our prod server. Occasionally, this also create problem when one of us forgets to download the latest copy from prod and overwrites the last change. I know this is very very foolish, but currently our prod server is the only copy that has all the updates and latest changes.
Can anyone please suggest which is the best version control system for me? I am more interested in distributed version control, since we don't have a central backup for all our code. I read about Mercurial and Git and found that Mercurial is used in several large open source projects by Mozilla, Sun, Symbian etc. So which one do you think is better for me? Not only version control, if there are any other package that I can use to make my current setup better, please mention that too :)
It sounds like Git can accomplish your goals quite well. As it's distributed, it's excellent for working locally since you can perform most operations (commit, revert, diff, patch) without connecting to a central server. You can also avoid that ugly moment of someone pushing new code to production while someone else is working on it, and then having the complicated task of merging those two versions of the code together (git provides a useful tool for doing this called rebase).
You noted there's some big projects using Hg (Mercurial), but there's some pretty big ones using Git, like the Linux Kernel, X.org, Android and Debian.
I use git for all my sites: it's lightning fast, efficient, and easy to use.
Edit: If you want to get into using Git, I'd recommend doing some reading before jumping right in. Starting off on the wrong foot can have some terrible implications later on. If you follow an Agile Workflow, you might want to check this out. Here's a website I learned most of my Git know-how from.
Version control is an incredible tool even when you're working alone, and when you are working with someone else it's indispensable. I would recommend using git. It's very fast, has a really great set of available tools, and of course has github.com. Mercurial is basically just as good as git, but it runs a little slower and doesn't have github.
For why to use git, please read http://whygitisbetterthanx.com/
Here's a nice-looking tutorial on getting started with git: http://www-cs-students.stanford.edu/~blynn/gitmagic/index.html
You can use SVN, Git, Mercurial.
The biggest challenge is having everyone be disciplined in using version control and not getting lazy.
Definitely Mercurial. Although you can use either Git or SVN, Mercurial is better for two reasons:
Vs Git: Good integration with Windows.
Vs SVN: It's distributed.
If you don't want to run yourself a Mercurial server (which is pretty easy anyway), there are many services available. Kiln + FogBugz is an EXCELLENT combination. There's also CodeBaseHQ (also supports Git and SVN), Bitbucket, and many more.
Before you jump onto it I strongly recommend you read at least Joel Spolsky's tutorial, but I strongly recommend you also read Mercurial: The Definitive Guide.
I am sorry, I had no intention of starting a DVCS holy war. I am going to try Git.
Yes, version control will help. To get started, I see two important issues for you:
hosted or self-managed? Do you want to host this yourself on a server, or want a service to take care of it for you? There are reasons to go either way, but if you're not that into managing the server look for a hosted option.
SVN or Git There are others, but these are the top open source contenders.
Pros and Cons (my opinion):
SVN: Good tutorials and fairly easy to get up-to-speed with. The training requirement is small (I've done a bit of it). SVN works really well with a co-located team, lots of projects, etc. With a limited number of branches (you may not need any), it is solid. There are plenty of integrations with other tools.
Git: Getting started can be a little rougher than with SVN. Some of the docs are good, but lots are geared assume a rather thorough understanding of the internals. Once you get the hang of it, it has great flexibility, but I've seen almost everyone who has started with it really stumble when beginning. Even after working with it for months, people debate the best patterns to use. It's really sweet for 1-person projects (where you want to track history), and for distributed projects like GitHub. I use Git even for small co-located teams, because I enjoy the speed and flexibility.
Given what you say about your team, though, I'd probably recommend trying SVN. There will be better resources to help you get going, and you'll be less likely to get frustrated with it.
Hope this helps.

Source Code Control Systems in Web Development

We are just beginning the process of looking for a source code control system. I realize we are behind, but better late than never. None of the members on our team have experience with any systems in their past so I was hoping I could find out some basic things to look for as we begin investigating different tools. Here is a little background on our team:
Our group consists of developers and designers
We work primarily on PC's with one or two on Mac's
Many are not comfortable with command line based systems
The majority of our development is for the web
We develop in ASP.NET, ColdFusion, and PHP
A few we plan on looking into:
SourceGear Vault
Concurrent Versions System
Subversion
Microsoft Visual SourceSafe
PVCS
Rational ClearCase
Team Foundation Server
Git
Tourtoise SVN
Bazaar
Any experiences with any of these would be helpful to hear about.
Do not use Source Safe! It's not only bad for source control it's just bad for the world.
I use Subversion with Tortoise. I love it. Rather easy to get up and running. Branching/Merging can still be a nightmare though.
Visual SVN is good too.
If you havent had a single sourcecontrolsystem so far, I rather doubt you can see the improvements of GIT etc.
Start simple and with a lot of support: use Subversion as Server and Tortoise as Client.
Its a easy setup and easy to use.
Subversion is especially suitable for web development because of the 'differencing' algorithm it uses for binary files. Web development isn't just about code. Binary resources come into play a lot (images, PDFs, etc).
Subversion tracks the differences between files and records those. Contrast that with CVS, which essentially stores another copy of the binary file, and the benefit becomes apparent as your binary resources and check-ins increase.
I use the TortoiseSVN plug-in, which is decent enough for me. As you specifically tag asp .net, you might want to look into VisualSVN, which does a great job in mitigating the biggest problem in version control - a colleague forgetting to add a file to the repository.
I also used Visual Sourcesafe back in the day. Don't know if it's still the same now, but its exclusive checkout per user was a complete nightmare in a team of multiple devs. Constantly had to remind people to check stuff back in or, alternatively, convince a friendly admin to log me in under their credentials whenever someone was out of office.
You may want to take a look at Perforce.
http://www.perforce.com/perforce/products.html
You should go with subversion, or maybe git or mercurial.
It's clearly not worth it for you to buy anything, I think you can remove commercial solutions from your list right away.
Also, you should probably get some 3rd party hosting instead of running your own server.
I work at a client where they use TortoiseSVN as the client and installed VisualSVN (Subversion) as the server component. At one point we had this master plan to use nANT and CruiseControl to keep 3 different environments for a .NET website in sync, but we haven't gotten approval on that yet (shock). So until then, we use our Subversion server to hold all the source code and keep the different environments in sync manually. Its not the best scenario in the world but it gives everyone access to the code and our development group is small enough that its easy enough for everyone to know what is being worked on.
Subversion as a server, and tortoise svn as a client, could fit very well for your requirements, althought I hear that GIT is newer and has a lot of improvement.
I'd second using Tortoise SVN, avoiding SourceSafe and add another to the list:
Perforce - This what was used at one of my former workplaces. It wasn't bad though the merges were painful to do in that it took 1-2 developers a day to get the code merged to move from one environment to other,e.g. dev->test, test->staging.
Tortoise SVN has a lot of built-in windows explorer options that can be used instead of the command line so I rarely use the command line with Subversion.
If you do go with SourceSafe do beware that there is an admin tool to analyze the DB to see that should be run periodically and can be a little annoying as I don't think anyone is supposed to be using SS when the analyser is running. The branching in VSS is kind of weak, especially in contrast to seeing how well things work in SVN.
Another point is to consider if you have a bug-tracking system and want to have an integration between the two.
i personally use git with cygwin. i prefer it over svn because of the pain that svn has caused me in the past with merges. git was designed with making merges painless and it does a very effective job at adhering to that.
if cygwin isn't your cup of tea and you need to have windows explorer integration, please check out the ToroiseGit project. It has the look and feel of ToroiseSVN so it's easy to pickup. you can even run ToroitseGit and TortoiseSVN side by side if you desire.
also TortoiseGit has built in support for SVN repos so you can check out an svn repo and get all the benefits of local branches and what have you.
It true that VSS should not be considered - it is a dead product and just plain bad. However, Team Foundation Server - especially 2010 should be given a look. It not only does source code control but it has a work item tracking system, CI and build server and has some really great tools for testing. For example, it will run automated scripts and record the session in an mpeg movie so that you can actually see what the screen looked like when/if the test failed.
If that's more than what you want, go with SVN.
First advice: Don't use SourceSafe. It's a nightmare. I think even Microsoft developers don't use it internally!
You could go with SVN using TortoiseSVN as a front-end for the people not comfortable with the command line. But you will have to host your own Subversion server or to find an hosting provider for your repositories.
Also, there is SVN plugins for the most used IDE out there.
Another +1 to Subversion. Have used with a variety of languages, including ColdFusion. Tortoise is great for windows, the best graphical clients for Mac are not free, however.
Would also recommend against Rational Clearcase. Their client is kludgy and there aren't near as many plugins for different ide/platforms.
I'm currently working with Rational ClearCase and I cannot complain (at least, 'till now).
Before that we used ChangeMan Dimensions, that's a regular CVS tool with many resources but in my opinion, it makes source control become very burocratic, to say the least: it features the infamous exclusive checkout. I also don't like the design.
ClearCase has a Windows-Explorer look and once you get used to it, it becomes very simple to use. It also has a nice and easy integration with MS Visual Studio.
SourceGear Vault is a great tool. Its interface is similar to VSS, but it doesn't have all the problems.
If you use .net and visual studio or are in a heavily MS environment you may really like TFS. It has very good integration with Visual Studio. It also has lots of other functions like tracking tasks, bugs, etc. and automating builds. It is expensive, especially in the world of SCMs where you can get a lot for free (svn, git). Since you mentioned .net though it may be worth a look.
You need to make a decision as to whether you want to pay for it or have one for free. I know SVN and CVS are free and there are great UI clients and IDE plugins also available for free.
We started off with CVS and then transitioned to SVN a few years ago. The advantages we had were that a. SVN repo was smaller, b. It was accessible over the net through both http and https, c. Had great client UI tools (i use SmartSVN), there are also great plugins for eclipse and intelliJ. d. transitioning from using CVS to SVN was very easy as a user.
I've used QVCS by link text they have fair and much cheaper prices, for different versions.
I've used and tried subversion, and I personally do not like it, but if people like it and use, that's awesome for them.
I say you should find one that has the features you need, and price range that is reasonable, and has a good support system..
The hard part is getting everyone on your team to use it, and use it wisely...
Personally, I really like Subversion and the tortoiseSvn client as many have already noted. One site I found that I really like is http://www.springloops.com. They offer cheap SVN hosting, but they also integrate with BaseCamp which I love for managing projects. If you like Basecamp and also use Svn, its worth a look
Git with GitHub for Windows and/or TortoiseGit.

What is your preferred php deployment strategy? [closed]

As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance.
Closed 10 years ago.
I'm beginning a new project in PHP and I'd love to get some feedback from other developers on their preferred strategy for PHP deployment. I'd love to automate things a bit so that once changes are committed they can be quickly migrated to a development or production server.
I have experience with deployments using Capistrano with Ruby as well as some basic shell scripting.
Before I dive head first on my own it would be great to hear how others have approached this in their projects.
Further information
Currently developers work on local installations of the site and commit changes to a subversion repository. Initial deployments are made by exporting a tagged release from svn and uploading that to the server.
Additional changes are typically made piecemeal by manually uploading changed files.
For PHP, SVN with Phing build scripts are the way to go. Phing is similar to ANT but is written in PHP, which makes it much easier for PHP developers to modify for their needs.
Our deployment routine is as follows:
Everyone develops on the same local server at work, every developer has a checkout on his machine back home as well.
Commits trigger a post-commit hook which updates a staging server.
Tests are ran on staging server, if they pass - continue.
Phing build script is ran:
Takes down production server, switching the domain to an "Under construction" page
Runs SVN update on production checkout
Runs schema deltas script
Runs tests
If tests fail - run rollback script
If tests pass, server routes back to production checkout
There's also phpUnderControl, which is a Continuous Integration server. I didn't find it very useful for web projects to be honest.
I'm currently deploying PHP using Git. A simple git push production is all that's needed to update my production server with the latest copy from Git. It's easy and fast because Git's smart enough to only send the diffs and not the whole project over again. It also helps keep a redundant copy of the repository on the web server in case of hardware failure on my end (though I also push to GitHub to be safe).
We use Webistrano, a web frontend for Capistrano, and are very happy with it.
Webistrano allows multi-stage, multi-environment deployments from SVN, GIT and others. It has built-in rollback support, support for separate server roles such as web, db, app, etc., and deploys in parallel. It allows you to override config parameters on multiple levels, such as per stage, and logs the results of every deploy, optionally mailing it.
Even though Capistrano and Webistrano are Ruby applications, the syntax of the deployment 'recipes' is easy and powerful enough to understand for any PHP programmer. Originally Capistrano was built for Ruby on Rails projects, but easily accommodates PHP projects.
Once configured it is even easy enough to be used by non-programmers, such as testers deploying a staging version.
To provide the fastest deploy possible we installed the fast_remote_cache method, which updates a svn working-copy cache on the remote server, and then hardlinks the result.
I use Apache Ant to deploy to different targets (dev, QA and live). Ant is designed to work for Java deployment, but it provides a pretty useful general case solution for deploying arbitrary files.
The syntax of the build.xml file is pretty easy to learn - you define different targets and their dependencies which run when you call the ant program on the command line.
For example, I have targets for dev, QA and live, each of which depends on the cvsbuild target which checks out the latest head revision from our CVS server, copies the appropriate files to the build directory (using the fileset tag), and then rsyncs the build directory to the appropriate server. There are a few quirks to learn, and the learning curve is not totally flat, but I've been doing it this way for years with no trouble so I'd recommend it for your situation, though I'm curious what other answers I'll see on this thread.
I do stuff manually using Git. One repository for development, which gets git push --mirror'ed to a public repo, and the live server is a third repo pulled from that. This part I suppose is the same as your own setup.
The big difference is that I use branches for nearly every change I'm working on (I've got about 5 right now), and tend to flip back and forth between them. The master branch doesn't get changed directly except for merging other branches.
I run the live server direct from the master branch, and when I'm finished with another branch and ready to merge it, flip the server to that branch for a while. If it breaks, putting it back to master takes seconds. If it works, it gets merged into master and the live code gets updated. I suppose an analogy of this in SVN would be having two working copies and pointing to the live one via a symlink.
I know Phing has been mentioned a few times now, but I've had great luck with phpUnderControl. For us we
Check out individual copies of branches to local machines
Branches are tested and then merged into Trunk
Commits to Trunk are automatically built by phpUnderControl, runs tests and builds all documentation, applies database deltas
Trunk gets run through quality testing and then merged into our Stable branch
Again, phpUnderControl automatically builds Stable, runs tests, and generates documenation and updates database
When we're ready to push to production we run a rsync script that backs up Production, updates the database, and then pushes the files up. The rsync command is invoked by hand so that we make sure someone is watching the promotion.
an alternative to home-made deployment scripts is to deploy to a platform-as-a-service which abstracts away a lot of that work for you. A PaaS will typically offer its own code deployment tool, as well as scaling, fault-tolerance (eg. not going down when hardware fails), and usually a great toolkit for monitoring, log checking etc. There's also the benefit of deploying to a known good configuration which will be kept up-to-date over time (one less headache for you).
The PaaS I would recommend is dotCloud, in addition to PHP (see their PHP quickstart) it can also deploy MySQL, MongoDB and a whole bunch of additional services. It also has nice goodies like zero-downtime deployment, instant rollback, full support for SSL and websocket, etc. And there's a free tier which is always nice :)
Of course I'm slightly biased since I work there! Other options worth checking out in addition to dotCloud are Pagodabox and Orchestra (now part of Engine Yard).
Hope this helps!
Solomon
That you automatically and blindly take changes from a repository to production servers sounds dangerous. What if your committed code contains a regression bug, so your production application gets glitchy?
But, if you want a Continuous Integration system for PHP, I guess Phing is the best choice for PHP. I haven't tested it myself, though, as I do stuff the manual way of e.g. scp.
I am way late to the party, but I thought I would share our methods. We use Phing with Phingistrano, which provides Capistrano-like functionality to Phing via pre-built build files. It is very cool, but only works if you use Git at the moment.
I have a working copy of an SVN release branch on the server. Updating the site (when there aren't schema changes) is as easy as issuing an SVN update command. I don't even have to take the site offline.
Phing is probably your best bet, if you can stand the pain of xml configuration files. The Symfony framework has its own port of rake (pake), which works quite well, but is rather tightly coupled to the rest of Symfony (Though you could probably separate them).
Another option is to use Capistrano. Obviously it doesn't integrate as well with PHP, as it does with Ruby, but you can still use it for a lot of stuff.
Lastly, you can always write shell scripts. So far, that's what I have done.
http://controltier.org/wiki/Main_Page
we are going to use it for multi-server deployments & maintenance.
One year late but...
In my case, deployment is not automatic. I find it dangerous to deploy code and run database-migration scripts automatically.
Instead, subversion hooks are used to deploy only to testing/staging server. Code is deployed to production at the end of an iteration, after having run tests and made sure things will work. For the deployment itself, I use a custom-made Makefile that uses rsync for transferring files. The Makefile may also run the migration scripts on the remote server, pause/resume web and database servers.
At my work myself and my team have developed a Phing oriented replacement for capistrano's deploy and we've also incorporated some of the goodies available in phing like PHPUnit testing, phpcs and PHPDocumentor. We've made it a git repo that can be added to a project as a submodule in git and it works very well. I've attached it to a handful of projects and it's modular enough that it's easy to make it work with any project on any of our several environments (staging, testing, production, etc...).
With the phing build scripts you can run them from the command line manually, and I've also had success automating the build/deploy routines with Hudson and now Jenkins ci.
I can't post any links now because the repo isn't public yet, but I've been told we're going to open source it sometimes soon, so please feel free to contact me if you're interested or if you have any questions on automating your deployment with phing and git.
I guess SVN deploy way is not very good. Because:
You need to open the SVN access for the whole world
have many .svn in the production web servers
I think Phing to produce a branch + combine all the js/css + replace stage config + ssh upload to all www servers is better way.
ssh to 10 www server and svn up is also trouble.

How to get started with version control and PHP [closed]

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
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 beginning.
I am the only developer at my work using Mac OS X and traditionally just been using FTP.
Can anyone help me with version control in relation to PHP projects (does it matter)?
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:
Never wondering what is your latest version once you go back to a project (no more myproject090201-archive2-final6.zip)
Never fear to start off some major refactoring, if you make a mistake on your file, you'll just rollback to the latest version
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
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:
Subversion (also called SVN)
Git
Mercurial
Bazaar
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):
Versions
Cornerstone
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!
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.
I use Git for PHP development.
It's fast, flexible, reliable, clean (CVS and SVN create a lot of hidden folders that I personally don't like).
Its distributed nature allow to work the way you want (with or without a central repository).
You can find more about it here:
Gitmagic
Speed Benchmarks
Moreover, you can get the Eclipse PDT (PHP Plugin) and use Subclibse in the IDE.
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.
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/
use bazaar http://bazaar-vcs.org/
it's very nice and you can start using it in minutes.
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.
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.

Categories