如何从git存储库中删除旧版本的媒体文件 [英] How to remove old versions of media files from a git repository

查看:140
本文介绍了如何从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.

这篇关于如何从git存储库中删除旧版本的媒体文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆