Git deployment: removing files when push files removed
<p>I have a <em>post-receive</em> hook to deploy my app in <em>webroot</em> when I push on <em>master</em> branch.
This is my script:</p>

<pre><code>#!/bin/bash
while read oldrev newrev ref
do
    if [[ $ref =~ .*/master$ ]];
    then
        echo "Master ref received.  Deploying master branch..."
        git --work-tree=/var/www/mywebroot --git-dir=/home/myuser/myrepo checkout -f master
    else
        echo "Ref $ref successfully received.  Doing nothing."
    fi
done
</code></pre>

<p>The problem is that when I push any commit that deletes any file, the files were removed are not removed in webroot.</p>