Using Git to deploy code changes..
Wouldn't it be nice have your changes up and running at a development site just by pushing it there with
git push dev
? Well with Git that's pretty easy to achieve.
First create a new Git repository on the remote if you haven't yet:
Then push your code to this repository initially and then check it out:
So now we need to make Git automatically checking out the latest code once you pushed it in. For that create the script ".git/hooks/post-receive":
And don't forget to make the file executable.
Now as the code is automatically updated, we need to disable the usual warning when one pushes to a remote repository with a checkout:
That's it. Simple and useful, not? :)
Credits go to http://toroid.org/ams/git-website-howto, which I used to come up with this.