在数百次提交后切换到 Git LFS 时是否应该迁移本地历史记录?

发布于 2025-01-16 22:29:16 字数 692 浏览 0 评论 0原文

我有一个 git 存储库(一个使用 GDScript 的 Godot 游戏项目),我已经工作了很长一段时间,并且有大约一千次提交,已推送到 GitHub。

我将开始使用 Git LFS 添加二进制资源,例如图像或声音文件。

查看 git-lfs-migrate 文档我可能应该迁移本地历史记录以转换一些已经存在的 png 文件。现在,这看起来是一个重大变化,我并不坚持搬起石头砸自己的脚,所以我想知道这种类型的存储库迁移的最佳实践是什么。

我是唯一一个在这个存储库上工作的人,所以即使像强制推送这样的亵渎行为对我来说也是可以接受的,只要我不丢失我的代码并且可以转换我的大文件。

澄清:主要是我不确定迁移本地历史或不重写本地历史可能产生的后果。不确定这些选择的优点和缺点是什么。

我考虑使用 Git LFS 的原因是,到目前为止我只编辑了文本文件,但现在我要添加许多大型二进制文件(图像、声音、数据文件),这些文件在开发过程中会发生变化,所以不使用 LFS 就太浪费了。理想情况下,我只想在将存储库克隆到各种测试环境时下载最新的二进制文件。

I have a git repository (a Godot game project using GDScript) that I've been working on for quite a while and has about a thousand commits, pushed to GitHub.

I'm to start adding binary assets like image or sound files with Git LFS.

Looking at the git-lfs-migrate docs I should probably migrate the local history to have some already existing png files converted too. Now, this looks like a significant change and I don't insist on shooting myself in the foot, so I'd like to know what is the best practice for this type of repository migration.

I'm the only one working on this repository so even sacrileges like force pushing is acceptable to me, as long as I don't lose my code and can convert my large files.

Clarification: Primarily I'm unsure about the possible consequences of migrating the local history or going without rewriting local history. Not sure what's the pros and cons are for these choices.

The reason why I'm considering Git LFS is that so far I've only been editing text files, but now I'm about to add a number of large binaries (images, sounds, data files), which will change during development, so not using LFS would be a waste. Ideally I'd only like to download the latest binaries when I'm cloning the repository to my various test environments.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

梦回旧景 2025-01-23 22:29:16

最后我没有迁移任何东西,只是安装了git-lfs,然后将更改推送到GitHub上的远程存储库。当我在另外两台计算机(Linux 和 Mac)上克隆存储库时,也不要忘记在那里安装 git-lfs,在这两种情况下,我都收到了一个奇怪的错误,抱怨“涂抹过滤器 lfs 失败”。

这个SO答案是解决方案: https://stackoverflow.com/a/48882513/63377

本质上LFS没有设置了一个网址,但它太胆怯了,不敢告诉我。我必须运行 git config lfs.url $(git config remote.WHATEVER-MY-LFS-REMOTE-NAME-IS.url) ,然后再执行另一个 git pull ,这一切似乎都在发挥作用。

Finally I did not migrate anything, just installed git-lfs, then pushed the changes to the remote repository on GitHub. When I cloned the repository on my 2 other computers (a Linux and a Mac), not forgetting to install git-lfs there too, on both cases I received a weird error, complaining about "smudge filter lfs failed".

This SO answer was the solution: https://stackoverflow.com/a/48882513/63377

Essentially LFS didn't have a URL set and it was too timid to tell me. I had to run git config lfs.url $(git config remote.WHATEVER-MY-LFS-REMOTE-NAME-IS.url), then do another git pull, and it all seems to be working.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文