Skip to content

Instantly share code, notes, and snippets.

@mozhu1024
Created November 5, 2019 09:39
Show Gist options
  • Save mozhu1024/6e208a9d0b6205ef63999235e34a4538 to your computer and use it in GitHub Desktop.
Save mozhu1024/6e208a9d0b6205ef63999235e34a4538 to your computer and use it in GitHub Desktop.
[GFB-GC] Git永久删除文件和历史记录 #git #gfb #shell #cmd
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch PATH-TO-YOUR-FILE-WITH-SENSITIVE-DATA' --prune-empty --tag-name-filter cat -- --all
git for-each-ref --format='delete %(refname)' refs/original | git update-ref --stdin
git reflog expire --expire=now --all
git gc --prune=now
git push origin --force --all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment