仅保留 GitHub 上的最新文件
有没有可能只保留 GitHub 上某些特定文件的最新版本?
例如,我想将一些 pdf 文件上传到 GitHub,但我不想浪费太多空间来保留这些 pdf 的历史记录。
虽然将二进制文件上传到 GitHub 并不是一个好主意,但确实很方便。
Is there a possible way to keep only the latest version of some specific files on GitHub?
For example, I want to upload some pdf files to GitHub, but I don’t want to waste too much space keeping the history of those pdfs.
Although upload binary files to GitHub is not a good idea, it is really convenient.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
不,没有办法做到这一点。 Git 旨在跟踪项目的历史记录,如果您不想跟踪历史记录,那么您不应该使用 Git。如果您想存储或保留数据而不存储历史记录,可以使用常规网站或云存储桶。
请注意,Git LFS 对此不是一个好的选择,因为它还会保留历史记录。唯一的区别是您不使用的文件不在本地计算机上;而是在本地计算机上。它们只保存在服务器上。如果您不想保留历史记录,那么在任何地方(即使在服务器上)保留旧版本也是没有意义的。
No, there is no way to do that. Git is designed to track the history of a project, and if you don't want to track history, then you should not use Git. You can use a regular website, or a cloud bucket, if you'd like to store or persist data without storing history.
Note that Git LFS is not a good choice for this, because it also keeps history. The only difference is that files that you aren't using aren't on your local machine; they're only kept on the server. If you don't want to keep history, then there's no point in persisting old versions anywhere, even on the server.
使用
git-lfs
存储大文件而不会使存储库膨胀。或者考虑这是否适合使用 Git;或许可以使用 Amazon S3 等云存储来代替。
Use
git-lfs
to store large files without bloating the repository.Or consider whether this is an appropriate use of Git; perhaps use cloud storage such as Amazon S3 instead.
使用
git-lfs
存储大文件而不会使存储库膨胀。在 Git 项目中存储大型 blob 时需要小心。 Github 发布了一些关于此的指南......
Use
git-lfs
to store large files without bloating the repository.You need to be careful storing large blobs inside of Git projects. Github publishes some guidelines around this...