@kannonboy @kannonboy Photo: Le Monde en Vidéo
@kannonboy @kannonboy Photo: Le Monde en Vidéo
Git LOB! Git LFS! @kannonboy @kannonboy Photo: Le Monde en Vidéo
ok cool Git LFS! @kannonboy @kannonboy Photo: Le Monde en Vidéo
Practical workflows with Git LFS TIM PETTERSEN • SENIOR DEVELOPER • ATLASSIAN • @KANNONBOY
Agenda THE PROBLEM WITH BIG FILES GIT LFS CONVERTING YOUR REPO TIPS FOR TEAMS @kannonboy
data model @kannonboy
master feature/JIRA-123 @kannonboy
git cat-file -p 98ca9 $ fad3d.. parent bab1e.. tree 434bb.. 98ca9.. committer Tim P <kannonboy@…> 1455209277 -0800 author Tim P <kannonboy@…> 1455209277 -0800 My life is my commit message. bab1e.. @kannonboy
git cat-file -p 434bb $ fad3d.. 100644 blob ace23.. .gitignore 100644 blob dbdbd.. README.md 040000 tree a0bc3.. app 98ca9.. 040000 tree 33d33.. con fj g 434bb.. 100755 blob b1de7.. deploy-prod.sh 100755 blob 7011e.. deploy-staging.sh bab1e.. type fj lemode SHA-1 @kannonboy
master ace23.. 1010101 fad3d.. dbdbd.. 1010101 1010101 a0bc3.. 1010101 98ca9.. 33d33.. 434bb.. 1010101 b1de7.. 1010101 bab1e.. 7011e.. 1010101 @kannonboy
fad3d.. 98ca9.. bab1e.. @kannonboy
fad3d.. 98ca9.. bab1e.. @kannonboy
150mb fad3d.. 434bb.. 100mb 98ca9.. dabad.. 50mb bab1e.. 86753.. @kannonboy
@kannonboy
Git LFS (Large File Storage) @kannonboy
$ fad3d.. 434bb.. Git host 98ca9.. dabad.. bab1e.. LFS store 86753.. @kannonboy
☞ ☞ ☞ git push $ fad3d.. 434bb.. Git host 98ca9.. dabad.. bab1e.. LFS store 86753.. @kannonboy
☞ ☞ ☞ git pull $ fad3d.. 434bb.. Git host 98ca9.. dabad.. bab1e.. LFS store 86753.. @kannonboy
☞ ☞ ☞ ☞ ☞ ☞ fad3d.. fad3d.. git cat-file -p 4749d $ bdd12.. 434bb.. 434bb.. version https://git-lfs.github.com/spec/v1 98ca9.. 98ca9.. oid sha256:325ddfb… size 29342295 dabad.. dabad.. 4749d.. bab1e.. bab1e.. 86753.. 86753.. 778aa.. @kannonboy
$ brew install git-lfs $ git lfs install @kannonboy
$ cat ~/.gitconfig [filter "lfs"] clean = git-lfs clean %f smudge = git-lfs smudge %f required = true @kannonboy
$ git lfs track “*.mp4” $ cat .gitattributes *.mp4 filter=lfs diff=lfs merge=lfs -text @kannonboy
☞ Work tree Clean fj lter Index (git-lfs clean) massive_video.mp4 massive_video.mp4 .git/objects dev $ git add @kannonboy .git/lfs/objects
☞ Commit tree Smudge fj lter Work tree (git-lfs smudge) massive_video.mp4 massive_video.mp4 .git/objects dev $ git checkout @kannonboy LFS Store .git/lfs/objects
$ cat ~/.gitconfig [filter "lfs"] clean = git-lfs clean %f smudge = git-lfs smudge %f required = true @kannonboy
git push / pull .git/objects Hosted repo .git/lfs/objects LFS store @kannonboy
$ ls .git/hooks/ commit-msg.sample post-update.sample pre-commit.sample pre-push ... @kannonboy
$ git push Git LFS: (12 of 13 files, 1 skipped) 168.75 MB / 180.87 MB, 12.12 skipped Counting objects: 22, done. ... @kannonboy
$ git pull remote: Counting objects: 3, done. ... Downloading massive_video.mp4 (38.79 MB) ... 1 file changed, 2 insertions(+) @kannonboy
$ git clone ssh://git@bitbucke.. Cloning into ‘big_repo’ ... Downloading massive_video.mp4 (38.79 MB) ... Checking out files: 100% (13/13), done. @kannonboy
☞ Converting to Git LFS @kannonboy
☞ !? 150mb !? 41222.. ace34.. 150mb fad3d.. 434bb.. 100mb 98ca9.. dabad.. @kannonboy
git filter-branch $ git filter-branch --force --index-filter \ 'git rm --cached --ignore-unmatch big_video.mp4’ \ --prune-empty --tag-name-filter cat -- --all ! S I H T O D T ’ N O D @kannonboy
$ git filter—branch --prune-empty --tree-filter ' git config -f .gitconfig lfs.url “https://bitbucket.example.com/team/repo.git” git lfs track "*.mp4" git add .gitattributes .gitconfig for file in $(git ls-files | xargs git check-attr O filter | grep "filter: lfs" | sed -r "s/(.*): D T filter: lfs/\1/"); do ’ N O git rm -f --cached ${file} D S I H git add ${file} T ! R done' --tag-name-filter cat -- --all E H T I E @kannonboy @kannonboy
BFG Repo-Cleaner @kannonboy @kannonboy
BFG Repo-Cleaner built to 10-720x faster Git LFS kill history than fj lter-branch support @kannonboy @kannonboy
$ git filter—branch --prune-empty --tree-filter ' git config -f .gitconfig lfs.url “https://bitbucket.example.com/team/repo.git” git lfs track "*.mp4" git add .gitattributes .gitconfig for file in $(git ls-files | xargs git check-attr O filter | grep "filter: lfs" | sed -r "s/(.*): D T filter: lfs/\1/"); do ’ N O git rm -f --cached ${file} D S I H git add ${file} T ! R done' --tag-name-filter cat -- --all E H T I E @kannonboy @kannonboy
$ brew install bfg $ bfg —-convert-to-git-lfs ‘*.{zip,mp4}’ --no-blob-protection @kannonboy
Enable in Bitbucket @kannonboy
Tips for teams @kannonboy
Beware merge conflicts @kannonboy @kannonboy
…meanwhile in @kannonboy
…meanwhile in @kannonboy
Teamwork Teamwork @kannonboy @kannonboy
$ git lfs fetch --recent $ git config lfs.fetchrecentalways “true” lfs.fetchrecentrefsdays (default = 7) lfs.fetchrecentcommitsdays (default = 0) lfs.fetchrecentremoterefs @kannonboy
Fetch the bare necessities Fetch the bare necessities @kannonboy @kannonboy
# for a build that just runs the unit tests $ git config lfs.fetchexclude Assets/** # for an audio engineer $ git config lfs.fetchinclude Assets/Audio/** @kannonboy
GUI tools @kannonboy @kannonboy
1. Install EGit Team Provider version 4.2+ 2. Make sure git-lfs is on your path @kannonboy
SourceTree @kannonboy
Looking docs for git-lfs.github.com more? source github.com/github/git-lfs Bitbucket Server atlassian.com/bitbucket Bitbucket Cloud coming soon! @kannonboy
@kannonboy @kannonboy
Thank you! TIM PETTERSEN • SENIOR DEVELOPER • ATLASSIAN • @KANNONBOY
More recommend