0

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?

Gabe
  • 1
  • 1
  • Are you checking the clone _that you ran filter-repo in_ or a completely different clone? – user1686 Jun 27 '23 at 17:10
  • @user1686 the same clone that I ran filter-repo – Gabe Jun 27 '23 at 17:35
  • This question would benefit from a [mcve]. Can you add the complete set of steps you're executing? From cloning the repository, to cd'ing into the repository, to running `git filter-repo`. Include the output produced by `git filter-repo`. – larsks Jun 27 '23 at 23:28

1 Answers1

0

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
...
Gabe
  • 1
  • 1