Can't get git filter-repo to work - No files are removed

347 views Asked by At

We have a git repo that had some code we didn't want visible publicly pushed to a public repo. I am trying to use git filter-repo to remove the files from the repo.

I have created a text file containing the relative paths to the files I want removed in, called to_remove.txt.

to_remove.txt:

...
src\unwanted_code\a.c
src\unwanted_code\b.c
src\unwanted_code\c.c
src\unwanted_code\d.c
...

I though this operation would be as simple as CD'ing into a fresh clone of the repo and running the following command:

git filter-repo --paths-from-file to_remove.txt --invert-paths

Upon running this command with the --debug flag, I can see that the file is being read and the paths are being put into the filter. The command will run without fault, but when I check my local clone of the repo, literally nothing has changed and all of the unwanted .c files are still there. I am confused what I am doing wrong. Does anyone have any insight?

1

There are 1 answers

0
Gabe On

Resolved this issue. The problem was that my to_removed.txt has \ instead of /. Should have looked like this:

...
src/unwanted_code/a.c
src/unwanted_code/b.c
src/unwanted_code/c.c
src/unwanted_code/d.c
...