Git workflow for web development

2019-03-20 07:30发布

问题:

I have been playing around with git on my local machine and everything makes sense until it comes to a remote and multiple developers I start getting confused.

My goal is to have a "semi public" dev site/s that a group of 4 people can work on and push changes to the live site as they are ready. We need the dev site/s to be on the public web server so that we can get approvals before pushing changes live. Security isn't a huge concern so I am planning on just using a simple .htaccess to restrict access. Not all of the changes need to be approved but I want the dev site/s to stay up to date.

The big challenge is that 2 of the 4 of us are designers and so the whole process of making a change and pushing it live needs to be fast and simple. They are used to just ftping changes to the site. I don't want to make a 10 step process to do what they are doing with a keyboard shortcut right now.

Any suggestions?

回答1:

Check out:

  • Git for designers
  • GitX, a graphical Git tool for OS X
  • Capistrano for deployment

This should get everyone familiar with using git and give you a tool for efficiently pushing out changes.



回答2:

Before going further, I'll state quite clearly that git is not a web deployment tool. Capistrano and friends are the superior solution, and mandatory for complex systems. However, if you have a simple enough site and don't care about atomic deployments, dependencies, forced process (ensuring all changes were QAed, etc), and the like, you can sometimes get away with a post-receive hook which does a forced git checkout. Then the process of deploying to a website would be to push to a special repository. You could either have one repository for QA and one for production, or have the hook check the branch being pushed to and figure it which to update that way.

See http://toroid.org/ams/git-website-howto for more information on a simple post-receive hook for automatic checkout.

Of course, you can also have the post-receive hook call an actual web deployment system to take care of some of the problems mentioned above.



标签: git web workflow