I have a remote bare repo on my server. I want the server to always have the current working tree as a real directory in the system.
I am using the post-receive
git-hook with a command to build the working tree and to override the old tree:
git archive master | tar -x -C /dir/to/my/project/
However, this approach has a problem: It does not delete files that were deleted/moved in the repo.
I could simply erase the whole project directory but I want to keep all files that are ignored in my .gitignore.
I tried to write a script to delete all files that are not ignored but it takes minutes to process.
Is there a way to replicate the working tree without erasing ignored files?