Git 大文件存储扩展


Git LFS 是一个 Git 的扩展。LFS 全称 Large File Storage,顾名思义是大文件存储。目的是更好地把大型二进制文件,比如音频文件、数据集、图像和视频,集成到Git的工作流中。

版权声明:本文为 frendy 原创文章,可以随意转载,但请务必在明确位置注明出处。


为什么需要 LFS 扩展


因为 Git 默认会压缩并存储二进制文件的所有完整版本,如果二进制文件很多,效率显然不是最优的。

Git LFS 处理大型二进制文件的方式是用文本指针来替换它们。这些文本指针实际上是包含二进制文件信息的文本文件。文本指针存储在 Git 中,而大文件本身通过 HTTPS 托管在 Git LFS 服务器上。

image


下载


https://github.com/git-lfs/git-lfs/releases

使用


git lfs track "*.zip"
git add demo.zip
git commit -m "add demo"
git push

更多命令


Commands
--------

Like Git, Git LFS commands are separated into high level ("porcelain")
commands and low level ("plumbing") commands.

High level commands
--------------------

* git lfs env:
    Display the Git LFS environment.
* git lfs checkout:
    Populate working copy with real content from Git LFS files
* git lfs clone:
    Efficiently clone a Git LFS-enabled repository
* git lfs fetch:
    Download git LFS files from a remote
* git lfs fsck:
    Check GIT LFS files for consistency.
* git lfs install:
    Install Git LFS configuration.
* git lfs lock:
    Set a file as "locked" on the Git LFS server.
* git lfs locks:
    List currently locked files from the Git LFS server.
* git lfs logs:
    Show errors from the git-lfs command.
* git lfs ls-files: //查看
    Show information about Git LFS files in the index and working tree.
* git lfs pull:
    Fetch LFS changes from the remote & checkout any required working tree files
* git lfs push:
    Push queued large files to the Git LFS endpoint.
* git lfs status:
    Show the status of Git LFS files in the working tree.
* git lfs track:
    View or add Git LFS paths to Git attributes.
* git lfs unlock:
    Remove "locked" setting for a file on the Git LFS server.
* git lfs untrack:
    Remove Git LFS paths from Git Attributes.
* git lfs update:
    Update Git hooks for the current Git repository.
* git lfs version:
    Report the version number.

Low level commands
-------------------

* git lfs clean:
    Git clean filter that converts large files to pointers.
* git lfs pointer:
    Build and compare pointers.
* git lfs pre-push:
    Git pre-push hook implementation.
* git lfs smudge:
    Git smudge filter that converts pointer in blobs to the actual content.


欢迎来撩

frendy

It will shine for us...