title: How do I use git-tfs and idiomatic git branching against a TFS repository?
body: <h1>How Do I Use git-tfs Idiomatically?</h1>
  
  <ul>
  <li><p>The git idiom is to check out branches <em>to the root directory</em> of the repository. Checking out a branch will replace the contents of the directory with the contents of that branch.</p></li>
  <li><p>The TFS idiom is to check out <em>each branch in a different directory</em> under the root directory of the repository (even the master or trunk branch). Checking out a branch will place it in a new directory next to the current one.</p></li>
  </ul>
  
  <p>Using <a href="https://github.com/spraints/git-tfs" rel="noreferrer">git-tfs</a>, I can clone a TFS repository or branch into a git repository. I want to  <strong>work on a TFS repository with multiple branches in a manner consistent with the git branching idiom</strong>. But I'm not sure what's technically possible or recommended :)</p>
  
  <hr>
  
  <h2>Clone The Whole TFS Repository</h2>
  
  <p>If I clone the whole repository out of TFS</p>
  
  <pre><code>&gt; git tfs clone http://&lt;tfsurl&gt;:8080 $/main
  </code></pre>
  
  <p>That would give me a git <code>master</code> containing <em>all</em> the TFS branches as directories.</p>
  
  <pre><code>[master]&gt; dir
    trunk
    feature-logon
    feature-search
    release-0.0.1
  </code></pre>
  
  <hr>
  
  <h2>Add a Remote Per TFS Branch</h2>
  
  <p>I don't know if I can (or how to) map a git remote to each TFS branch.</p>
  
  <pre><code>&gt; git init .
  [master]&gt; git tfs clone http://&lt;url&gt; $/main/trunk .
  </code></pre>
  
  <p>Then</p>
  
  <pre><code>[master]&gt; git checkout -b feature-logon
  [feature-logon]&gt; git tfs clone http://&lt;url&gt; $/main/feature-logon .
  </code></pre>
  
  <p>I know this is technically incorrect, but I don't know any better without playing (my only TFS repo is very large, experimenting is taking a long time)</p>