Skip to content

Instantly share code, notes, and snippets.

@zyzo
Last active August 29, 2015 14:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zyzo/98d614eed25b4173c9b4 to your computer and use it in GitHub Desktop.
Save zyzo/98d614eed25b4173c9b4 to your computer and use it in GitHub Desktop.
Step to remove completely a file and its histories from git
1. Delete file from git repository
1. Download bfg.jar from http://rtyley.github.io/bfg-repo-cleaner/
2. mirror clone the project
$ git clone --mirror git://example.com/my-repo.git
3. Run
$ java -jar bfg.jar --delete-files fileToDelete my-repo.git
4. Update
$ cd my-repo.git
$ git reflog expire --expire=now --all && git gc --prune=now --aggressive
5. Finally, push it back up :
$ git push
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment