Skip to content

Instantly share code, notes, and snippets.

@pansila
Created April 2, 2018 09:29
Show Gist options
  • Select an option

  • Save pansila/d9d084bf7090b5851bcdceb959a61b0f to your computer and use it in GitHub Desktop.

Select an option

Save pansila/d9d084bf7090b5851bcdceb959a61b0f to your computer and use it in GitHub Desktop.
Remove a file in the git database permanently
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch FILE_PATH' --prune-empty --tag-name-filter cat -- --all
git push origin master --force
rm -rf .git/refs/original/
git reflog expire --expire=now --all
git gc --prune=now
git gc --aggressive --prune=now
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment