git lfs
阿里云:如何使用Git LFS?
gitcode:Git LFS
目录
- 使用 LFS 上传单个大文件到远程仓库
- 查看 git lfs 当前跟踪的文件列表
- 不再通过 LFS 跟踪 .pdf 文件
使用 LFS 上传单个大文件到远程仓库
git lfs track "*.pdf" # .pdf后缀结尾的文件使用Git LFS进行存储("*.bigfile"的双引号必须加)
git lfs track # 查看当前已跟踪的Git LFS File 类型
git add .gitattributes && git commit -sm "Add *.pdf LFS config" # 为了让"*.pdf"的配置生效,需要将.gitattributes文件进行提交
追加大文件
git add . && git commit -sm "Add pdf file"
git push origin release
-
git lfs track "*.pdf"→ .pdf后缀结尾的文件使用Git LFS进行存储("*.bigfile"的双引号必须加)

-
git lfs track→ 查看当前已跟踪的Git LFS File 类型

-
git add .gitattributes && git commit -sm "Add *.pdf LFS config"→ 为了让"*.pdf"的配置生效,需要将.gitattributes文件进行提交

-
git add . && git commit -sm "Add pdf file"→ 把一个.pdf文件push到远程仓库

查看 git lfs 当前跟踪的文件列表
git lfs ls-files → 查看 git lfs 当前跟踪的文件列表

不再通过 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 缓存



