git lfs
一、Introduction
git lfs可以处理仓库的大文件,把文件替换一个描述文件:
version https://git-lfs.github.com/spec/v1
oid sha256:4b641d1922fdc4d881e8ab37a11c9e4c20e4ed30795728dbe7801c6940e7fe13
size 16270720
这样可以减少仓库的体积,减少在fetch时的耗时,在真正checkout时再去下载。
二、Usage
1. Ubuntu 安装git-lfs:
curl -s https://packagecloud.io/install/repositories/github/git-lfs/script.deb.sh | sudo bash
sudo apt-get install git-lfs
2. 在git仓库中执行
git lfs install
3. 添加文件
使用track添加文件:
git lfs track big.data
git add -f .gitattributes
git commit -m 'test lfs'
git push origin HEAD:master
4. 其它用法
列出所有track的文件:
$ git lfs ls-files
b07a4d07b1 - model/yolov2_lite.weights
4aae0cec15 - model/yolov2_pro.weights
bcac516a60 - model/yolov3/yolov3.nb
$ git lfs track
Listing tracked patterns
model/realnet_yolov3_0xA5.nb (model/.gitattributes)
model/yolov2_lite.weights (model/.gitattributes)
model/yolov2_pro.weights (model/.gitattributes)
Listing excluded patterns