I’m setting up a general git deployment environment and I’m wondering if it’s safe to set up a symlink to a .git directory? By doing so, I’m hoping to be able to have seperate checkouts from the same repo without having to have to local copies of the history of a potentially large project.
Reasoning (pseudo-flow):
- web interface:
- click “Deploy this commit to this server”
- server:
ln -s ./deploy/.git ./build/.gitcd buildgit fetchgit checkout some_commitmake- if success:
cd ..mv build deploymake deploy// just reset nginx, apache, etc
- if failure
- alert user
- wipe build directory, no harm done
Check out
git-new-workdir, a tool purpose-built for checking out multiple working directories from one .git directory.