The obviously the best solution for every site, but for some small weekend projects on a VPS, it’s pretty useful, and enforces usage of Git, too.
First make your public dir in your project folder. Make sure by default your web server isn’t serving your entire project folder.
Then start your git repository.
git init
git add .
git commit -m'initial'
Now it’s time to create the staging area. git-new-workdir is the command we’re using for that. Problem is, on Ubuntu it’s a little more hidden
cd /usr/share/doc/git/contrib/workdir/
bash git-new-workdir /var/www/[PROJECT]/public /var/www/[PROJECT]/beta
Check out your new beta/ folder with the contents of the public dir! It has to be a separate branch, though.
git branch beta
git checkout beta
Work on the private version of your site, committing often. When you’re ready to show it off, just push it to the Master branch.
Leave A Comment?