title: How to delete files from VCS history?
body: <p>I have an old source code repository which I would like to share publicly. However, it includes some files which I do not want to share. I would like to create a new VCS branch with these files removed entirely from its history, but would like to keep as much of the rest of the history as possible intact, esp. commit messages, and ideally also commit dates.</p>
  
  <p>It is currently a <a href="https://bazaar.canonical.com/en/" rel="nofollow noreferrer">Bazaar</a> repository, although I expect to convert it and publish it as a Git repository using <a href="https://launchpad.net/bzr-git" rel="nofollow noreferrer">bzr-git</a>. Solutions for either VCS are acceptable.</p>
  
  <p>I imagine a hypothetical tool "regenerate-repo" which would recreate the repository, one commit at a time, while executing an arbitrary command between each commit, eg:</p>
  
  <pre><code>regenerate-repo $old_repo $new_repo --each-time='rm -R private-folder'
  </code></pre>
  
  <p>Does such a tool exist, or is there another way to accomplish my goal?</p>