Pushing to a remote git working copy
In the case where the remote working copy is the document root of your site and no one is ever making changes there, it's extremely annoying that git provides no flag to the push command to allow you to update the work tree as opposed to only the index.
Enter the post-update hook.
- download the post-update hook
- in the remote working copy (which you don't intend to actually work in), place the post-update file in $working_copy/.git/hooks
- make it executable
Voila. The working copy now actually updates when you push to it.
You will probably also want to suppress the long warning message that spews out every time you do this.
On the remote working copy:
$ git config receive.denyCurrentBranch ignoreSources:
http://hans.fugal.net/blog/2008/11/10/git-push-is-worse-than-worthless/#comment-1791
http://git.wiki.kernel.org/index.php/GitFaq#Why_won.27t_I_see_changes_in_the_remote_repo_after_.22gi...
Advanced note: if you'd like to automatically pop stashed remote working copy changes back onto HEAD, see the attached stash-pop.patch to the post-update hook. Use at your own risk. ;)
| Attachment | Size |
|---|---|
| stash-pop.patch | 472 bytes |
| post-update.orig | 2 KB |
| post-update.patched | 2.21 KB |

