title: Safely using junction or mklink /j with a git repository on Windows
body: <p>Using Git on Windows, I'm trying to deal with content that's external to my git repo. We have artwork and content files for instance that are being updated by non git-users in google drive so to capture these changes I've setup something similar to the following;</p>
  
  <pre><code>d:\MyRepo
    \.git
    \code1
    \images1
    \fonts (junction) =&gt; c:\users\%username%\google drive\designerLtd\fonts
    \etc
  </code></pre>
  
  <p>Where 'fonts' is a folder has been linked using either <code>junction.exe</code> or <code>mklink /j</code> (same thing). This generally works out great because <code>Git status</code> immediately highlights new changes (either on purpose or by accident) and prepares them for checkin or undo.</p>
  
  <p><strong>ISSUE</strong>: sometimes when switching branches Git prunes the linked directories and re-creates them if content in those folders is different between branches. In effect it breaks the link. Now Git is always correct and the build is consistent but it's not always obvious that it is no longer keeping track of those external resources.</p>
  
  <p>Worse still, it can delete files in the external location. They can be recovered from git of course, but it's very unwieldy.</p>
  
  <p>Swapping the content in the external locations when branches are switched isn't a problem, because there's only one PC that's hooked up this way and they're easily merged, but I just wish it didn't break the links.</p>
  
  <p><strong>QUESTION</strong>: Is there a better way to allow external junction points within a Git repo on Windows?</p>
  
  <p>To be clear, there are no symlinks in the GIT repository (yet) as far as I know and this isn't a question about interoperability between Unix and Windows git clients (which most of the other questions on SO seem to relate to).</p>