Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>I recommend <a href="http://dound.com/2009/04/git-forever-remove-files-or-folders-from-history/" rel="noreferrer">this script</a> by David Underhill, worked like a charm for me. </p> <p>It adds these commands in addition natacado's filter-branch to clean up the mess it leaves behind:</p> <pre class="lang-bash prettyprint-override"><code>rm -rf .git/refs/original/ git reflog expire --all git gc --aggressive --prune </code></pre> <p>Full script (all credit to David Underhill)</p> <pre class="lang-bash prettyprint-override"><code>#!/bin/bash set -o errexit # Author: David Underhill # Script to permanently delete files/folders from your git repository. To use # it, cd to your repository's root and then run the script with a list of paths # you want to delete, e.g., git-delete-history path1 path2 if [ $# -eq 0 ]; then exit 0 fi # make sure we're at the root of git repo if [ ! -d .git ]; then echo "Error: must run this script from the root of a git repository" exit 1 fi # remove all paths passed as arguments from the history of the repo files=$@ git filter-branch --index-filter \ "git rm -rf --cached --ignore-unmatch $files" HEAD # remove the temporary history git-filter-branch # otherwise leaves behind for a long time rm -rf .git/refs/original/ &amp;&amp; \ git reflog expire --all &amp;&amp; \ git gc --aggressive --prune </code></pre> <p>The last two commands may work better if changed to the following:</p> <pre><code>git reflog expire --expire=now --all &amp;&amp; \ git gc --aggressive --prune=now </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload