title: Completely removing a folder from git
body: <p>To remove a folder named <strong>build</strong> from git I use:</p>
  
  <pre><code>git rm --cached -r build
  </code></pre>
  
  <p>As I learned from this <a href="https://stackoverflow.com/questions/24290358/remove-a-folder-from-git-tracking">answer</a>.</p>
  
  <p>However, IIUC, the directory remains in the git's database.</p>
  
  <p>I tested the matter:</p>
  
  <ol>
  <li>Initialised a new git repository.</li>
  <li>Added a new directory, named <strong>build</strong>, with a large file (7MB) and committed.</li>
  <li><p>performed: </p>
  
  <pre><code>git rm --cached -r build
  </code></pre></li>
  </ol>
  
  <p>The size of the <strong>.git</strong> directory remained 7mb which means the untracking and deletion did not change the git history, presumptuously as it should.</p>
  
  <p>What is the way to completely clean up a wrongly committed directory which was committed a few commits back?</p>
  
  <p>In my case as I was only on my third commit with little concern to the history of the project, I deleted the <strong>.git</strong> folder and started over but I am wondering whether there is a better way.</p>