I’ve been using git for everything in the World lately. To be honest I’ve not been understanding much of anything I read. I basically read something and then hack around until I get it working. The hack around part is a pain. It consists of writing little scripts and then testing how I think it works and finding it doesn’t really work that way. So then I run the setup script again which erases all the work and initializes everything all over to the point where I failed. So I can try over. And over. And over about 20x.
Anyways, today I read this excellent post http://debuggable.com/posts/git-tip-auto-update-working-tree-via-post-receive-hook:49551efe-6414-4e86-aec6-544f4834cda3 and implemented it. It allows me to simply push the changes out to the webserver without ftp or rsync. It’s quite nice. Just make an executable file at .git/hooks/post-receive and stick in it:
#!/bin/sh
cd ..
env -i /usr/local/bin/git reset –hard
I need to make the .git directory off limits to prying eyes. I will do that in the future. For now though it doesn’t have anything in it that is not already viewable so it’s not important. Later though.