git
Pro Git
Atlassian Git Tutorial
Pro Git 简体中文翻译
GitX
Atma
V2EX  ›  git

git lfs 迁移

  •  
  •   Atma · Jun 1, 2024 · 2686 views
    This topic created in 716 days ago, the information mentioned may be changed or developed.

    现有代码仓库有些资源文件占用比较大,所以迁移 lfs ,按照 lfs 迁移 https://help.aliyun.com/document_detail/321367.html?spm=a2c4g.206889.0.i2

    https://confluence.atlassian.com/bbkb/moving-git-large-files-to-git-lfs-in-bitbucket-cloud-1236441468.html 迁移之后,lfs 已经迁移成功,但是代码仓库体积 double 了,看.git 下是之前 object 的文件还存在,然后 lfs object 又有一份, 执行 git reflog 和 gc 之后 push 无变化

    目前查询了一些博客或者问答,还没找到原因: https://forum.gitlab.com/t/gitlab-lfs-migration-doubles-reposize/27151/2

    https://community.atlassian.com/t5/Bitbucket-questions/Repository-not-shrinking-after-migration-to-LFS-What-do/qaq-p/908843

    想问下有木有迁移过的小伙伴,是迁移之后需要用 BFG 再清理一遍 git 的提交记录吗

    5 replies    2024-06-03 09:23:37 +08:00
    mengjisang
        1
    mengjisang  
       Jun 1, 2024
    git lfs 的 track 规则,需要你在建仓的时候就设置,不然即使你后面使用了 lfs 来管理,.git 里面也会保留记录,占用空间
    Ally
        2
    Ally  
       Jun 1, 2024
    nightwitch
        3
    nightwitch  
       Jun 2, 2024
    中途转 git-lfs 的话,重写 git 历史不可避免的(因为以前的二进制资源已经被存进了.git)里。
    Atma
        4
    Atma  
    OP
       Jun 2, 2024 via Android
    @nightwitch
    @mengjisang
    @Ally 好的,我处理一下
    dif
        5
    dif  
       Jun 3, 2024
    把大文件的的提交删掉呗。
    git verify-pack -v .git/objects/pack/pack-*.idx | sort -k 3 -g | tail -5
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   3004 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 12:52 · PVG 20:52 · LAX 05:52 · JFK 08:52
    ♥ Do have faith in what you're doing.