我的git存储库非常大,我想通过删除一些大文件来减小它的大小,这些大文件是我过去添加的,稍后已经删除,但仍然存在于git历史记录中。 现在我找到了git filter-branch --tree-filter命令。 所以我试过这个:
git filter-branch --tree-filter 'DEL /content/de/files/bigfile.zip' --all(我在Windows上)。
但是调用这个命令的结果是:
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>...]'我不知道该怎么办。 在当前的工作目录中,文件确实不存在。 但是它在历史上还有一些旧的承诺。 我的理解是,该命令会从每次提交中删除文件。
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.
最满意答案
所以我的版本中的实际错误是,我用单引号而不是双引号。 看起来像,至少在Windows上,你必须使用这些。
也就是说,jthill的评论和Roberto的回答可能为目前的任务提供更好的解决方案。
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.
更多推荐
发布评论