卖不甜枣 发表于 2025-1-8 05:38:42

git lfs

阿里云:怎样使用Git LFS?
gitcode:Git LFS


使用 LFS 上传单个大文件到长途仓库


[*] git lfs track "*.pdf" → .pdf后缀结尾的文件使用Git LFS举行存储("*.bigfile"的双引号必须加)
https://i-blog.csdnimg.cn/direct/3744e7b785ee47e8874b29dc014f4124.png
[*] git lfs track → 查看当前已跟踪的Git LFS File 范例
https://i-blog.csdnimg.cn/direct/6dc692836c094baabe200562581f9239.png
[*] git add .gitattributes && git commit -sm "Add *.pdf LFS config" → .为了让"*.pdf"的配置见效,需要将.gitattributes文件举行提交
https://i-blog.csdnimg.cn/direct/4033ddf427b647dbad660ceb2905e57f.png
[*] git add . && git commit -sm "Add pdf file" → 把一个.pdf文件push到长途仓库
https://i-blog.csdnimg.cn/direct/ca1fabc583a34f4bba722e1f58151d78.png
查看 git lfs 当前跟踪的文件列表

git lfs ls-files → 查看 git lfs 当前跟踪的文件列表
https://i-blog.csdnimg.cn/direct/1cfb84fda1a7477aafed80d08b69082f.png
不再通过 LFS 跟踪 .pdf 文件

# 从 Git 仓库的暂存区移除所有 .pdf 文件,但保留它们在工作目录中
git rm --cached "*.pdf"

# 如果之前是通过 LFS 跟踪,还需要移除 LFS 跟踪规则
git lfs untrack "*.pdf"                           # 从 LFS 跟踪中移除 *.pdf 文件
git add .gitattributes
git commit -m "Untrack *.pdf files from LFS"
git lfs prune                                     # 清理 LFS 缓存
https://i-blog.csdnimg.cn/direct/16ffa17c6d344349a324ac41b16033db.png
https://i-blog.csdnimg.cn/direct/c31a6fc49c634bebbfac8790493d3b06.png
https://i-blog.csdnimg.cn/direct/6413885c6d3c4c4fb59fcc791d639fbe.png

免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。
页: [1]
查看完整版本: git lfs