Created
June 22, 2018 23:50
-
-
Save gojimmypi/6b984539f5d4bb0fd2327d14f1334965 to your computer and use it in GitHub Desktop.
Delete a git file
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
git filter-branch --force --index-filter 'git rm --cached --ignore-unmatch FILE_TO_DELETE.TXT' --prune-empty --tag-name-filter cat -- --all | |
# see https://stackoverflow.com/questions/2004024/how-to-permanently-delete-a-file-stored-in-git | |
# | |
# "This command will run the entire history of every branch and tag, changing any commit that involved the file, | |
# and any commits afterwards. Commits that are empty afterwards (because they only changed the Rakefile) are removed entirely." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment