git - How to modify old, pushed commit, with new commits pushed after it
问题描述
I am in the process of migrating a repo from gitlab to github, as our repo ran out of space there, and it doesn't seem as though we can expand it's size. So, naturally, I created the new repo on github, I added the ssh address to the existing remotes on my local instance of the repo, and I tried calling
git push --mirror github
After letting this run for hours, it fails. After doing research into why this might be, I saw that it may be too large to push up at once, and I should loop through batches of commits and push them up one at a time. During this process, everything works perfectly for the first commit that adds the .gitignore and .gitattributes files.
However, right after this point, we go to push the files from the actual project and already we are pushing files that are too big for github but were not too big for gitlab, so they are not expressed to be tracked in LFS at that point.
Basically, I want to go back two years worth of commits, add in the LFS tracking to these files, insert this commit before the files are added, and then have it update the remaining tree.
I have tried resetting my HEAD back to that point, amending the .gitignore with the new LFS data, and pushing that up before the files are added. However, when trying this route, I now encounter errors when trying to push up the old commits, as it says that the old commits are out of date and need to pull.
Is what I am asking for even possible?
解决方案
Git LFS 提供了一个命令来迁移你的历史git lfs migrate
如果您的大文件是 zip、jpg、png
首先检查试运行:
git lfs migrate info --everything --include="*.zip,*.png,*.jpg"
然后去争取
git lfs migrate import --everything --include="*.zip,*.png,*.jpg"
推荐阅读
- javascript - 使用 @HostBinding 设置多个内联样式属性
- elasticsearch - 查询与文档不是 1:1 的数据的弹性搜索索引
- excel - 如何从现有宏创建宏?
- sql - 如何不使用 regexp_replace 替换模式中的单词?
- android - 微调器侦听器 OnItemSelectedListener 函数,无需单击微调器
- postgresql - 如何在 Ecto 模式中设置 `DateTime` 和 `timestamp with time zone` (`timestamptz`) PostgreSQL 类型的迁移?
- selenium - 如何在附件中找到“Pace”一词的动态 xpath?
- python-3.x - Python 3.7 附加函数问题
- microsoft-graph-api - 如何使用 Microsoft Graph 获取分配给我的应用程序列表?
- botframework - 将呼叫转接到另一个 MS 机器人