title: Push Git branches directly into a live server directory so files are seen live
body: <p>How can I set up remote directories in Git where I can locally push a stage branch to the remote and see the live changes on a staging server, like stage.example.com?</p>
  
  <p>The notion I have (part of why I am moving away from SVN) is that I can maintain (locally) 3 different "main" branches as follows:</p>
  
  <ul>
  <li><strong>master</strong> - used for local development, working dir</li>
  <li><strong>stage</strong> - should be in-sync with staging server directory (remote)</li>
  <li><strong>live</strong> - this should be the publicly accessible website (remote)</li>
  </ul>
  
  <p>The idea I have (and what others claim is possible) is that I can maintain these remote "sites" from my local computer without having to constantly log into my remote server shell and run <code>svn update</code> (in my current svn workflow I need to do this all the time…) or of course in my Git workflow run <code>git pull</code> on the remote.</p>
  
  <p>How can I setup the remote directories so that I can locally push my <code>stage</code> branch to the <code>staging remote server</code> and see the changes on <em>(for example)</em> <code>stage.example.com</code> right away?</p>
  
  <p>Then once the <code>stage</code> is all okay and tested I would just locally be able to <code>push</code> to the <code>live</code> remote to make these changes that I have tested on the <code>stage</code> to the live website.</p>
  
  <p>Can this even be done or am I getting crazy ideas here that are simply not meant to be done with Git?</p>
  
  <p>In case this is of importance here are a few stats about my local and remote servers:</p>
  
  <pre>
  remote server:      Dreamhost (shared account)
  remote GIT version: 1.7.1.1
  remote GIT client:  shell
  
  local computer:     Mac Pro (Snow Leopard 10.6.6)
  local GIT version:  1.7.2.3
  local GIT client:   Tower.app // git-tower.com
  </pre>
  
  <p>Also, so far I have <strong>unsuccessfully</strong> tried the following workflow:</p>
  
  <ol>
  <li>Create a <code>--bare</code> Git repo on the remote (so I can access it from everywhere)</li>
  <li>Clone this remote repo to a local directory and the use Git Tower app to manage it</li>
  <li>Work locally in <code>master (HEAD)</code></li>
  <li><code>scp -r</code> copy the <code>--bare</code> git repo from the remote server into my remote live domain <code>stage.example.com</code></li>
  <li>Add remote to local working copy and then try to push to <code>origin/stage</code> </li>
  </ol>
  
  <p>Clearly this doesn't work but I don't know why or how to do it any better.</p>
  
  <p>Coming from a SVN background I'm new to Git but have watched plenty of tutorials <em>(Peepcode &amp; ThinkVitamin)</em> but still cannot figure out how to set this up.</p>