@kannonboy @kannonboy Photo: Le Monde en Vido @kannonboy - - PowerPoint PPT Presentation

kannonboy kannonboy
SMART_READER_LITE
LIVE PREVIEW

@kannonboy @kannonboy Photo: Le Monde en Vido @kannonboy - - PowerPoint PPT Presentation

@kannonboy @kannonboy Photo: Le Monde en Vido @kannonboy @kannonboy Photo: Le Monde en Vido Git LOB! Git LFS! @kannonboy @kannonboy Photo: Le Monde en Vido ok cool Git LFS! @kannonboy @kannonboy Photo: Le Monde en Vido


slide-1
SLIDE 1

@kannonboy

Photo: Le Monde en Vidéo

@kannonboy

slide-2
SLIDE 2

@kannonboy @kannonboy

Photo: Le Monde en Vidéo

slide-3
SLIDE 3

@kannonboy

Git LFS! Git LOB!

@kannonboy

Photo: Le Monde en Vidéo

slide-4
SLIDE 4

@kannonboy

  • k cool

@kannonboy

Photo: Le Monde en Vidéo

Git LFS!

slide-5
SLIDE 5

TIM PETTERSEN • SENIOR DEVELOPER • ATLASSIAN • @KANNONBOY

Practical workflows with Git LFS

slide-6
SLIDE 6

@kannonboy

GIT LFS THE PROBLEM WITH BIG FILES TIPS FOR TEAMS

Agenda

CONVERTING YOUR REPO

slide-7
SLIDE 7

@kannonboy

data model

slide-8
SLIDE 8

@kannonboy

master feature/JIRA-123

slide-9
SLIDE 9

@kannonboy

434bb.. tree bab1e.. parent Tim P <kannonboy@…> 1455209277 -0800 committer Tim P <kannonboy@…> 1455209277 -0800 author My life is my commit message. 98ca9.. bab1e.. fad3d..

git cat-file -p 98ca9 $

slide-10
SLIDE 10

@kannonboy

git cat-file -p 434bb $

434bb.. 98ca9.. bab1e.. fad3d.. ace23.. 100644 blob .gitignore dbdbd.. 100644 blob README.md a0bc3.. 040000 tree app 33d33.. 040000 tree confjg b1de7.. 100755 blob deploy-prod.sh 7011e.. 100755 blob deploy-staging.sh type fjlemode SHA-1

slide-11
SLIDE 11

@kannonboy

434bb.. 98ca9.. bab1e.. fad3d.. ace23.. 1010101 dbdbd.. a0bc3.. 33d33.. b1de7.. 7011e.. 1010101 1010101 1010101 master 1010101 1010101 1010101

slide-12
SLIDE 12

@kannonboy

98ca9.. bab1e.. fad3d..

slide-13
SLIDE 13

@kannonboy

98ca9.. bab1e.. fad3d..

slide-14
SLIDE 14

@kannonboy

dabad.. 98ca9.. bab1e.. fad3d.. 86753.. 434bb..

50mb 100mb 150mb

slide-15
SLIDE 15

@kannonboy

slide-16
SLIDE 16

@kannonboy

(Large File Storage) Git LFS

slide-17
SLIDE 17

@kannonboy

dabad.. 98ca9.. bab1e.. fad3d.. 86753.. 434bb..

$

LFS store Git host

slide-18
SLIDE 18

@kannonboy

☞ ☞ ☞

dabad.. 98ca9.. bab1e.. fad3d.. 86753.. 434bb.. Git host LFS store

git push $

slide-19
SLIDE 19

@kannonboy

☞ ☞ ☞

dabad.. 98ca9.. bab1e.. fad3d.. 86753.. 434bb..

git pull $

LFS store Git host

slide-20
SLIDE 20

@kannonboy

☞ ☞ ☞

dabad.. 98ca9.. bab1e.. fad3d.. 86753.. 434bb..

☞ ☞ ☞

dabad.. 98ca9.. bab1e.. fad3d.. 86753.. 434bb.. https://git-lfs.github.com/spec/v1 version sha256:325ddfb…

  • id

29342295 size

git cat-file -p 4749d $

4749d.. bdd12.. 778aa..

slide-21
SLIDE 21

@kannonboy

$ brew install git-lfs $ git lfs install

slide-22
SLIDE 22

@kannonboy

$ cat ~/.gitconfig [filter "lfs"] clean = git-lfs clean %f smudge = git-lfs smudge %f required = true

slide-23
SLIDE 23

@kannonboy

$ git lfs track “*.mp4” $ cat .gitattributes *.mp4 filter=lfs diff=lfs merge=lfs -text

slide-24
SLIDE 24

@kannonboy

massive_video.mp4

Work tree

dev .git/lfs/objects

Clean fjlter

(git-lfs clean)

Index

massive_video.mp4

$

.git/objects

git add

slide-25
SLIDE 25

@kannonboy

$

dev .git/lfs/objects

Smudge fjlter

(git-lfs smudge)

Work tree

massive_video.mp4

Commit tree

massive_video.mp4 .git/objects LFS Store

git checkout

slide-26
SLIDE 26

@kannonboy

$ cat ~/.gitconfig [filter "lfs"] clean = git-lfs clean %f smudge = git-lfs smudge %f required = true

slide-27
SLIDE 27

@kannonboy

.git/lfs/objects .git/objects Hosted repo LFS store

git push / pull

slide-28
SLIDE 28

@kannonboy

$ ls .git/hooks/ commit-msg.sample post-update.sample pre-commit.sample pre-push ...

slide-29
SLIDE 29

@kannonboy

$ git push Git LFS: (12 of 13 files, 1 skipped) 168.75 MB / 180.87 MB, 12.12 skipped Counting objects: 22, done. ...

slide-30
SLIDE 30

@kannonboy

$ git pull remote: Counting objects: 3, done. ... Downloading massive_video.mp4 (38.79 MB) ... 1 file changed, 2 insertions(+)

slide-31
SLIDE 31

@kannonboy

$ git clone ssh://git@bitbucke.. Cloning into ‘big_repo’ ... Downloading massive_video.mp4 (38.79 MB) ... Checking out files: 100% (13/13), done.

slide-32
SLIDE 32

@kannonboy

Converting to Git LFS

slide-33
SLIDE 33

@kannonboy

434bb.. fad3d.. 98ca9.. 41222.. dabad..

100mb 150mb

ace34..

150mb!?

!?

slide-34
SLIDE 34

@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

D O N ’ T D O T H I S !

slide-35
SLIDE 35

@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 filter | grep "filter: lfs" | sed -r "s/(.*): filter: lfs/\1/"); do git rm -f --cached ${file} git add ${file} done' --tag-name-filter cat -- --all

@kannonboy

D O N ’ T D O T H I S E I T H E R !

slide-36
SLIDE 36

@kannonboy

BFG Repo-Cleaner

@kannonboy

slide-37
SLIDE 37

@kannonboy

BFG Repo-Cleaner

@kannonboy

10-720x faster than fjlter-branch built to kill history Git LFS support

slide-38
SLIDE 38

@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 filter | grep "filter: lfs" | sed -r "s/(.*): filter: lfs/\1/"); do git rm -f --cached ${file} git add ${file} done' --tag-name-filter cat -- --all

@kannonboy

D O N ’ T D O T H I S E I T H E R !

slide-39
SLIDE 39

@kannonboy

$ brew install bfg $ bfg —-convert-to-git-lfs ‘*.{zip,mp4}’

  • -no-blob-protection
slide-40
SLIDE 40

@kannonboy

Enable in Bitbucket

slide-41
SLIDE 41

@kannonboy

Tips for teams

slide-42
SLIDE 42

@kannonboy

Beware merge conflicts

@kannonboy

slide-43
SLIDE 43

@kannonboy

…meanwhile in

slide-44
SLIDE 44

@kannonboy

…meanwhile in

slide-45
SLIDE 45

@kannonboy

Teamwork

@kannonboy

Teamwork

slide-46
SLIDE 46

@kannonboy

$ git lfs fetch --recent $ git config lfs.fetchrecentalways “true” lfs.fetchrecentrefsdays lfs.fetchrecentremoterefs lfs.fetchrecentcommitsdays (default = 7) (default = 0)

slide-47
SLIDE 47

@kannonboy

Fetch the bare necessities Fetch the bare necessities

@kannonboy

slide-48
SLIDE 48

@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/**

slide-49
SLIDE 49

@kannonboy

GUI tools

@kannonboy

slide-50
SLIDE 50

@kannonboy

  • 1. Install EGit Team Provider version 4.2+
  • 2. Make sure git-lfs is on your path
slide-51
SLIDE 51

@kannonboy

SourceTree

slide-52
SLIDE 52

@kannonboy

coming soon!

Bitbucket Cloud

git-lfs.github.com

docs

github.com/github/git-lfs

source

atlassian.com/bitbucket

Bitbucket Server Looking

for

more?

slide-53
SLIDE 53

@kannonboy @kannonboy

slide-54
SLIDE 54

Thank you!

TIM PETTERSEN • SENIOR DEVELOPER • ATLASSIAN • @KANNONBOY