Version control PHP Web Project

2022-08-30 13:10:50

We have a PHP project that we would like to version control. Right now there are three of us working on a development version of the project which resides in an external folder to which all of our Eclipse IDEs are linked, and thus no version control.

What is the right way and the best way to version control this?

We have an SVN set up, but we just need to find a good way to check in and out that allows us to test on the development server. Any ideas?


答案 1

We were in a similar situation, and here's what we ended up doing:

  • Set up two branches -- the release and development branch.
  • For the development branch, include a post-commit hook that deploys the repository to the dev server, so you can test.
  • Once you're ready, you merge your changes into the release branch. I'd also suggest putting in a post-commit hook for deployment there.

You can also set up individual development servers for each of the team members, on their workstations. I find that it speeds things up a bit, although you do have some more setup time.

We had to use a single development server, because we were using a proprietary CMS and ran into licensing issues. So our post-commit hook was a simple FTP bot.


答案 2

Here is what we do:

  • Each dev has a VM that is configured like our integration server
  • The integration server has space for Trunk, each user, and a few slots for branches
  • The production server
  • Hooks are in Subversion to e-mail when commits are made

At the beginning of a project, the user makes a branch and checks it out on their personal VM as well as grabs a clean copy of the database. They do their work, committing as they go.

Once they have finished everything in their own personal space they log into the integration server and check out their branch, run their tests, etc. When all that passes their branch is merged into Trunk.

Trunk is rebuilt, the full suite of tests are run, and if all is good it gets the big ol' stamp of approval, tagged in SVN, and promoted to Production at the end of the night.

If at any point a commit by someone else is made, we get an e-mail and can merge those changes into our individual branches.


推荐