title: Extract a subtree using branch incrementally
body: <p>I'm using <code>git-subtree</code> to extract a directory from my project.</p>
  
  <pre><code>git subtree split --prefix=src/SubProject --branch=SubProject origin/master
  </code></pre>
  
  <p>Given this is how I would like to start the project to begin with (specifically no <code>--rejoin</code>) how can I split only the changes from <code>origin/master</code> to <code>SubProject</code> on successive runs?</p>
  
  <p>For smaller projects this has been working fine. I can live with ~5 seconds to split the project. But on larger repositories this can take quite some time. I've seen it take up to five minutes per split. Some of the projects I'd like to work with have upwards of 45 sub projects in one repository.</p>
  
  <p>I've tried many things that I thought might work but each has failed in one way or another. My requirements are:</p>
  
  <ul>
  <li>Must not mess with <code>origin/master</code> in any way (so for the most part <code>--rejoin</code> is out of the question)</li>
  <li>It must not add extra merge commits (think: <code>--ff-only</code> when getting new changes from <code>origin/master</code>)</li>
  <li>The <code>SubProject</code> repository must have stable commit ID's. Meaning that after one or more incremental updates to <code>SubProject</code>, it should have the same commit ID's in its history that it would get if I re-run the original command at the top of this post.</li>
  <li>It must be automated and require no manual intervention</li>
  </ul>
  
  <p>I'm not afraid of a complex solution but it needs to be automated. Failure because of history changing is fine; at that point the script can fall back to build the entire thing from scratch. In that case the user knows what they've done so they get to sit through a very long process of rebuilding from scratch. :)</p>
  
  <h3>--rejoin</h3>
  
  <p>I tried using <code>--rejoin</code> and keeping an extra copy of <code>origin/master</code> around to just be a container for the altered history added by <code>--rejoin</code>. The problem I ran into here was that I was not able to either <code>git rebase origin/master</code> or <code>git merge --ff-only origin/master</code> without intervention. I need to be able to do this in an automated way so this was not acceptable.</p>
  
  <h3>merge commits</h3>
  
  <p>I was able to get it to work as I wanted with <code>git merge origin/master</code> but it resulted in a merge commit. Since this merge commit will not ever go upstream the history going forward would, I think, be impossible to predict so a fresh <code>git subtree split</code> in a pristine environment would nto be able to reproduce the same exact history. <em>I could be wrong on this. If so, please explain to me how this will be safe. :)</em></p>
  
  <h3>commit ranges</h3>
  
  <p>I experimented with using a commit range and I was able to create a new subtree split in <code>SubProject</code> that only contained a list of commits from a certain point in time to <code>HEAD</code>. This would probably work except it looks as though it generates a new set of commit ID's so I do not think this will be an option.</p>