I am following the instructions on Github (https://help.github.com/articles/remove-sensitive-data/) to tidy up a messy repository. I have successfully cleared out all the .csv files using
git filter-branch --force --index-filter \ 'git rm --cached --ignore-unmatch *.csv' \ --prune-empty --tag-name-filter cat -- --all
And now need to remove all the .docx files. However, when I use exactly the same command with *.docx instead, I get an error saying: fatal: bad revision ' --prune-empty'
I pushed to the origin on github, and cloned a fresh copy before doing this second lot of updates. I'm not sure what I'm doing wrong/differently that is causing this error. Any help greatly appreciated :)
If you commit sensitive data, such as a password or SSH key into a Git repository, you can remove it from the history. To entirely remove unwanted files from a repository's history you can use either the git filter-repo tool or the BFG Repo-Cleaner open source tool.
The easiest way to delete a file in your Git repository is to execute the “git rm” command and to specify the file to be deleted. Note that by using the “git rm” command, the file will also be deleted from the filesystem.
Git should run from either cmd.exe or bash.
The problem is the use of '
in your command. Windows only uses "
. The command you are looking for is:
git filter-branch --force --index-filter \ "git rm --cached --ignore-unmatch *.csv" \ --prune-empty --tag-name-filter cat -- --all
Solved... I took out the space after the backslash which I'd been putting in before the --prune-empty
part, and it works as expected now! No idea why it works though....
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With