This question already has an answer here:
I'm adopting a git push to deploy method where I setup a bare repository on the live server which I push my local changes to. Using a post-update hook, executed after I've pushed I pull my changes to the directory housing the live site.
This method works extremely well but as we are using virtual servers sometimes disk space can be an issue, especially for out larger sites. My concern is that the bare repository and the repository where the site actually resides and is accessible means two (possibly large) repositories on the server, no?
Is i possibly to lighten this up a little? In my post-update hook, is it possible to only pull the latest changes and overwrite the previous files. Or, should I use 'cp' instead of 'git pull' for this? I suppose after every commit I could just remove all files in the site's directory and then do a pull, then delete the .git directory?
Anyway would appreciate hearing from anyone how this is best handled. Thank you