如何从git存储库中删除旧版本的媒体文件
我有一个包含几个巨大媒体文件(图像和音频文件)的Git存储库。这些媒体文件的几个版本已连续承诺回购。这些文件是相同资产的相继改进版本,并且它们具有相同的名称。
I have a Git repository with several huge media files (images and audio files). Several versions of these media files have been successively commited to the repo. The files are successively refined versions of the same assets, and they have the same name.
我只想保留Git存储库中的最新版本,因为它正在成为太大了。
这样做最简单的方法是什么?
如何正确地将这些更改传播到上游存储库?
I want to keep only the latest version in the Git repository, because it is becoming too big.
What is the simplest way to do this?
How can I propagate these changes correctly to the upstream repository?
我有一个脚本( github gist here )来删除选择从git仓库的整个历史记录中删除不需要的文件夹,或者删除除最新版本的文件夹以外的所有文件夹。
I have a script (github gist here) to remove a selection of unwanted folders from the entire history of a git repo, or to delete all but the latest version of a folder.
这是硬编码的,假设所有的git仓库在〜/ repos
中,但这很容易改变。它也应该很容易适应个人文件的工作。
It's hard-coded to assume that all git repositories are in ~/repos
, but that's easy to change. It should also be easy to adapt to work with individual files.