Skip to content

Instantly share code, notes, and snippets.

@hugoduraes
Last active November 30, 2016 10:36
Show Gist options
  • Save hugoduraes/824c4585d334fc4ef704ae010f2f9f3b to your computer and use it in GitHub Desktop.
Save hugoduraes/824c4585d334fc4ef704ae010f2f9f3b to your computer and use it in GitHub Desktop.
Deletes file from git history

Execute the following command replacing /path/to/sensitive-file by the file you wish to remove from git history:

git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch /path/to/sensitive-file' --prune-empty --tag-name-filter cat -- --all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment