Reputation: 2242
my git repository is quite big and I would like to bring its size down by removing some big files, which I added in the past and already removed later on, but which are still in the git history. Now I found the git filter-branch --tree-filter command. So i tried this:
git filter-branch --tree-filter 'DEL /content/de/files/bigfile.zip' --all
(I'm on Windows).
But the result of invoking this command is:
fatal: ambiguous argument '/content/de/files/bigfile.zip'': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
I don't know, what to do. In the current working directory, the file is indeed not present. But it is still there in a couple of old commits in the history. My understanding was, that the command would remove the file from every commit.
Upvotes: 5
Views: 3504
Reputation: 2242
So the actual mistake in my version was, that I used single quotes instead of double quotes. Seems like, at least on Windows, you have to use those.
That said, the comments from jthill and the answer from Roberto probably present better solutions to the task at hand.
Upvotes: 10
Reputation: 25304
You might want to consider the BFG, a faster and simpler alternative to git filter-branch. The equivalent command is :
$ bfg --delete-files bigfile.zip
https://rtyley.github.io/bfg-repo-cleaner/
Disclaimer : I am the author of the BFG
Upvotes: 1