diff --git a/slides/lfs/inferno.png b/slides/lfs/inferno.png new file mode 100644 index 0000000..1cf2a8e Binary files /dev/null and b/slides/lfs/inferno.png differ diff --git a/slides/lfs/lfs.md b/slides/lfs/lfs.md new file mode 100644 index 0000000..34a017e --- /dev/null +++ b/slides/lfs/lfs.md @@ -0,0 +1,101 @@ +# The Horrifying Cost + +If a Git has 2806 commits, and you commit 15MB worth of output each time, then you are a menace and must be stopped. + +```text + + 2806 commits x 15MB = 41GB + +``` + +# Initial Tactics: `.gitignore` + +``` +*.pdf +*.epub +Makefile +*.xcf +``` + +...but sometimes it's not enough. + +# Saving Your Immortal Soul + +![Well deserved fate](slides/lfs/inferno.png) + +End the madness with git lfs. + +# Setup + +```bash + +apt install -y git-lfs +cd $PROJECT +git lfs install +``` + +## Output: Easy Hooks + +```bash +cat ~/.git/hooks/pre-push +``` + +``` +#!/bin/sh +command -v git-lfs >/dev/null 2>&1 || { echo >&2 +"This repository is configured for Git LFS but +'git-lfs' was not found on your path. If you no +longer wish to use Git LFS, remove this hook by +deleting '.git/hooks/pre-push'."; exit 2; } + + +git lfs pre-push "$@" +``` + + +# Add Files + +Track all the files: + +```bash +git lfs track "*.iso" +git lfs track "*.png" +git lfs track "*.jpg" +git lfs track "*.jpeg" +git lfs track "*.tiff" +git lfs track "*.xlsx" +git lfs track "*.docx" + +cat .gitattributes +``` +Result: + +``` +*.jpg filter=lfs diff=lfs merge=lfs -text +*.svg filter=lfs diff=lfs merge=lfs -text +``` + +Double check with `git lfs ls-files`. + + +# Locking + +[ If your remote supports it ] +lock your files when working on them. + +# Migration + +Make sure you have all the files: + +```bash +git lfs fetch origin --all + +git lfs push $newRemote --all + +``` + +# Problems + +`soft-serve` does not yet support `git-lfs`. + +(end list)