I've committed a bunch of sensitive data to my local repo that has not been published yet.
The sensitive data is scattered across the project in different folders and I want to remove all these completely from git history.
All of the concerning folders have the same name, and are at the same level in the directory in different folders. Following is a sample of my folder structure:
root folder1 ./sensitiveData folder2 ./sensitiveData folder3 ./sensitiveData using the following command, I am able to delete the folders containing sensitive data one at a time:
git filter-branch -f --index-filter 'git rm -r --cached --ignore-unmatch javascript/folder1/.sensitiveData' --prune-empty HEAD But I want to delete all the folders containing sensitive data in one go, because, they are too many, and I would like to learn how this works.
But using the following command, nothing is rewritten and I am warned that 'refs/heads/master' is unchanged is unchanged:
git filter-branch -f --index-filter 'git rm -r --cached --ignore-unmatch javascript/*/.sensitiveData' --prune-empty HEAD As I see it, there are two strategies:
- Either my pattern is somehow wrong and I need to change it.
- Or I should do some looping with bash.
Option one seems more sensible if possible.
*does not expand in this context?