I am working on a large php/mysql application, and I am getting to the point that i have to use some kind of version control. I have read a few articles on GIT, but i can’t seen to figure out what the best way is to go about this.
I have a dedicated server that runs CENTOS with PLESK. And i mainly develop on my local machine that on which u use XAMPP.
If i want to use version control should i install this on the server that uses PLESK, or should i install this on my local machine. And will this also record the database changes i made.
Another thing i question is the use of the github. Should I still upload the changes to the hub, or do i need to make my own place on the server where the source files are stored.
Thank you for your time!
4
Answers
You don’t need version control on your deployment machine, it’s sufficient to have an SVN Repository which you connect to using your development machine. And when the current build / release is ready for production you simply upload it / deploy it.
There is no need for an SVN client on your production server.
You might also want to read this article about Using SVN for Web Development.
The normal procedure would be to develop your software using version control. When you have a release that needs to go to the test or live server you would deploy the code from the repository to the test/live server.
If you are using GIT then it only needs to be on your machine as this is how GIT is designed, as a distributed version control system. If you were using Subversion then that may well reside on a server away from your machine. However in this instance you would still deploy in the same way.
It is not normal to add the database changes to version control for various reasons (there is discussion of that in other question here on SO)
You only need to use GitHub if you are working with other people or are opening your code up to the wide world to download and uses. However another reason for uploading to GitHub would be in case your local machine with all the code and the repository crashed and you lost the local copies you could recover from there. However i assume you are making backups?
Edit – addition
There is a free book which deals with git but to deal with below you add a file called gitignore and in it you add the file patterns that you do not want in the repository. so you have local config file and remote config files on the target server but they do mnot get overwritten as your local files are not in the repository
With git, you don’t need a server. Any folder where git is used, i.e.
git --init
is run, becomes a git repository and stores all version information in.git
, a subfolder of that directory.Github is used for collaboration between open source projects – hosting a bare copy of the repository in a central place – a bare copy is just the .git folder without a working tree.
As for whether it can handle mysql database contents; git can track binary files, but mysql typically stores its data separate from your application’s source folders, so that might be hard to do.
As Filip says, you don’t need VCS on your deployment machine; that said, with git, you could just push up your commits.
I agree with other answers but If you like to use git and to have a fast test deployment method on your remote machine (useful for testing purposes) you could give a try to Gitosis.
It’s a simple git server solution, simply put you can have your own “git server” on your remote machine, useful to keep a remote backup copy of your work.
Than you can commit your changes locally or push them back to the remote machine.
On the remote machine you’ll have to clone the repository also in the directory you’re going to use for your project…
It’s easier than it seems and it work really good 🙂