Git & development setup for solo developer
I'm hoping for some pointers to i开发者_开发百科mprove my development workflow. I'm a solo developer currently running a number of sites on a dedicated Centos server and up until now I've just been developing locally on my machine and uploading to the server using FTP. I want to improve this setup by introducing Git for version control and by having a staging process, from local to staging to production.
I've installed Git on my production server and I've started creating repositories for each of my live sites (with .git inside the same directory as the live project). I still need to learn how to use Git properly, but is it advisable to have this type of setup?
In terms of having a staging site for each project, I am thinking of just starting with subdomains for each live site, still residing on the same server.
At a basic level, does this type of setup make sense? Thanks for any pointers!
This is the approach I use for my personal projects, and it's served me well for a very small number of very small sites. I generally wind up with a small shell script that pulls changes, adjusts permissions, runs any pending migrations, etc. Just make sure that your .git directory exists outside of the publicly-accessible web root (potentially a problem for from-scratch PHP sites, not so much with Rails or most PHP frameworks).
At work however, where we have many large sites, it becomes pretty tedious to manually pull changes, run migrations, adjust permissions, etc. We use a system called Capistrano, which will do the above steps (and many more) automatically. There is even an extremely user-friendly web-based front end, Webistrano.
Apart from the development cycle, people have been using Git for deployment as well
See this question for some pointers. The idea basically is to have a git installation on the production/staging server as well and have some scripts to automatically fetch changes from a specific branch and copy them over to your web server.
精彩评论