title: How to list the change history of the directory tree in git
body: <p>Git does not track directories as such. It only tracks files that live in some directory.
  (See <a href="https://stackoverflow.com/questions/115983/how-do-i-add-an-empty-directory-to-a-git-repository">How can I add an empty directory to a Git repository?</a>)</p>
  
  <p>However, if I have certain history of commits I implicitly also have history of changes to the directory tree.</p>
  
  <p>So how do I answer questions like:</p>
  
  <ol>
  <li>when was directory foo/bar created (in git terminology: when was the first file created in that directory). There could be more than one qualifying commit if foo/bar has been
  deleted some time in history and recreated later.</li>
  <li>when was directory foo/bar removed (in git terminology: when was the last file removed from that directory). As above there could be more than one qualifying commit.</li>
  <li>what are the subdirectories of foo/bar that existed in any point of time in history</li>
  </ol>
  
  <p>The closest I could come up with is in pseudo code:</p>
  
  <pre><code>loop over all commits (git rev-list --all)
    start from repo root directory
    do recursively on the directory tree rebuilt so far
      call git ls-tree and grep the tree lines
      rebuild next level of directory tree
    end
  end
  </code></pre>
  
  <p>Obviously this could be written in your favorite scripting language. </p>
  
  <p>Then I have all directory trees and I still need to search them in a smart way in order to be to answer questions of type 1 - 3. Again, doable but probably not in a couple of minutes. </p>
  
  <p>The questions are:</p>
  
  <ol>
  <li>Is there an easier way?</li>
  <li>If not: are suitable the scripts already on the net? (my googling didn't reveal any, but I did not come up the perfect search words either) </li>
  </ol>