title: How to resize the remote repository without deleting all the commit history?
body: <p>There are several very related question already on stackoverflow (a few are linked below) but I could not solve my particular problem.</p>
  
  <p>I share a repository with Co-workers who have pushed huge datafiles/images that increased the size of the remote repository up to 14 GB. Later on, these files got deleted using just <code>rm filename</code> which resized the local repositories to a reasonable size. However, when I check online, the repository's size is still 14 GB.</p>
  
  <p>What I tried to reduce the repositories size is what is suggested <a href="https://stackoverflow.com/questions/2116778/reduce-git-repository-size">here</a>:</p>
  
  <pre><code>git reflog expire --expire=now --all
  git gc --aggressive --prune=now
  </code></pre>
  
  <p>but that only affected my local repository's size.</p>
  
  <p>The <a href="https://stackoverflow.com/questions/492558/removing-multiple-files-from-a-git-repo-that-have-already-been-deleted-from-disk">answers here</a> did not help either since the files were not deleted on my own computer but on the Co-workers' ones.</p>
  
  <p>What I have not tried yet, but which might work is to delete all the commit history as described <a href="https://stackoverflow.com/questions/13716658/how-to-delete-all-commit-history-in-github">here</a> . However, I would actually keep all the commit history and just get rid of all the garbage created by <code>rm filename</code> on machines that are not my own.</p>
  
  <p>Is there any solution to this (getting rid of garbage created on other local machines to decrease the size of the remote repository) without removing all the commit history?</p>
  
  <p>EDIT:</p>
  
  <p>In <a href="https://stackoverflow.com/questions/2100907/how-to-remove-delete-a-large-file-from-commit-history-in-git-repository">@torek's link</a> in the comments, I found a command to get rid of commits related to a certain file. I then tried to get rid of all commits that are about images e.g. .png. I used the following command:</p>
  
  <pre><code>git filter-branch --tree-filter 'rm -f *.png' HEAD
  </code></pre>
  
  <p>However, I then get the message:</p>
  
  <blockquote>
    <p>WARNING: Ref 'refs/heads/master' is unchanged</p>
  </blockquote>
  
  <p>How would I use it correctly?</p>